-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Path::Tiny object is not coerced/stringified #68
Comments
@XSven ^^ |
Ok I have compared the current master with the commit 1cc2320 (0.49 tag) git diff 1cc2320 lib/OrePAN2/Injector.pm
diff --git a/lib/OrePAN2/Injector.pm b/lib/OrePAN2/Injector.pm
index 195b50b..aecf2fa 100644
--- a/lib/OrePAN2/Injector.pm
+++ b/lib/OrePAN2/Injector.pm
@@ -1,9 +1,9 @@
package OrePAN2::Injector;
-use strict;
-use warnings;
use utf8;
+use Moo;
+
use Archive::Extract ();
use Archive::Tar qw( COMPRESS_GZIP );
use CPAN::Meta ();
@@ -16,20 +16,12 @@ use File::Temp qw( tempdir );
use File::pushd qw( pushd );
use HTTP::Tiny ();
use MetaCPAN::Client ();
+use Types::Standard qw( CodeRef Str );
-sub new {
- my $class = shift;
- my %args = @_ == 1 ? %{ $_[0] } : @_;
- unless ( exists $args{directory} ) {
- Carp::croak("Missing directory");
- }
- bless {
- author => 'DUMMY',
- %args
- }, $class;
-}
+use namespace::clean;
-sub directory { shift->{directory} }
+has author => ( is => 'ro', isa => CodeRef | Str, default => 'DUMMY' );
+has directory => ( is => 'ro', isa => Str, required => 1 );
sub inject {
my ( $self, $source, $opts ) = @_; I guess my Perl knowledge is not sufficient here, but where in the former (highlighted in red) implementation is the |
I don't think the stringification happens in this (red) diff. It would happen when We could just use https://metacpan.org/pod/Types::Path::Tiny and coerce everything we get into a |
Closed via #69 |
See metacpan/metacpan-api#1161 (comment) This could use a regression test.
The text was updated successfully, but these errors were encountered: