diff -Nru libmoo-perl-2.004000/Changes libmoo-perl-2.004004/Changes --- libmoo-perl-2.004000/Changes 2020-04-09 17:56:16.000000000 +0000 +++ libmoo-perl-2.004004/Changes 2020-11-25 00:58:12.000000000 +0000 @@ -1,5 +1,20 @@ Revision history for Moo +2.004004 - 2020-11-25 + - fix error location test when using core Carp on perl 5.8.9 - 5.10.1 + +2.004003 - 2020-11-21 + - fix extraneous MANIFEST entry + +2.004002 - 2020-11-20 + - no changes + - releasing as stable + +2.004_001 - 2020-07-30 + - remove Module::Runtime prerequisite + - internal code cleanups + - added test for conflicts in extensions wrapping 'has' and similar subs + 2.004000 - 2020-04-09 - minor documentation tweaks - minor test tweaks diff -Nru libmoo-perl-2.004000/debian/changelog libmoo-perl-2.004004/debian/changelog --- libmoo-perl-2.004000/debian/changelog 2020-04-11 14:32:39.000000000 +0000 +++ libmoo-perl-2.004004/debian/changelog 2020-11-27 01:10:21.000000000 +0000 @@ -1,3 +1,20 @@ +libmoo-perl (2.004004-1) unstable; urgency=medium + + * Team upload. + * Import upstream version 2.004004. + + -- gregor herrmann Fri, 27 Nov 2020 02:10:21 +0100 + +libmoo-perl (2.004003-1) unstable; urgency=medium + + * Team upload. + * Import upstream version 2.004003. + * Update (build) dependencies: remove libmodule-runtime-perl. + * Declare compliance with Debian Policy 4.5.1. + * Bump debhelper-compat to 13. + + -- gregor herrmann Mon, 23 Nov 2020 19:38:26 +0100 + libmoo-perl (2.004000-1) unstable; urgency=medium * Team upload. diff -Nru libmoo-perl-2.004000/debian/control libmoo-perl-2.004004/debian/control --- libmoo-perl-2.004000/debian/control 2020-04-11 14:32:39.000000000 +0000 +++ libmoo-perl-2.004004/debian/control 2020-11-27 01:10:21.000000000 +0000 @@ -4,11 +4,10 @@ Section: perl Testsuite: autopkgtest-pkg-perl Priority: optional -Build-Depends: debhelper-compat (= 12) +Build-Depends: debhelper-compat (= 13) Build-Depends-Indep: libclass-method-modifiers-perl , libclass-xsaccessor-perl , libimport-into-perl , - libmodule-runtime-perl , libmoose-perl , librole-tiny-perl (>= 2.001004) , libscalar-list-utils-perl , @@ -19,7 +18,7 @@ libtest-simple-perl , libtype-tiny-perl , perl -Standards-Version: 4.5.0 +Standards-Version: 4.5.1 Vcs-Browser: https://salsa.debian.org/perl-team/modules/packages/libmoo-perl Vcs-Git: https://salsa.debian.org/perl-team/modules/packages/libmoo-perl.git Homepage: https://metacpan.org/release/Moo @@ -31,7 +30,6 @@ ${perl:Depends}, libclass-method-modifiers-perl, libimport-into-perl, - libmodule-runtime-perl, librole-tiny-perl (>= 2.001004), libscalar-list-utils-perl, libstrictures-perl (>= 2), diff -Nru libmoo-perl-2.004000/lib/Method/Generate/Accessor.pm libmoo-perl-2.004004/lib/Method/Generate/Accessor.pm --- libmoo-perl-2.004000/lib/Method/Generate/Accessor.pm 2020-04-08 08:49:03.000000000 +0000 +++ libmoo-perl-2.004004/lib/Method/Generate/Accessor.pm 2020-09-02 10:16:19.000000000 +0000 @@ -1,7 +1,7 @@ package Method::Generate::Accessor; use Moo::_strictures; -use Moo::_Utils qw(_load_module _maybe_load_module _install_coderef); +use Moo::_Utils qw(_load_module _maybe_load_module _install_coderef _module_name_rx); use Moo::Object (); BEGIN { our @ISA = qw(Moo::Object) } use Sub::Quote qw(quote_sub quoted_from_sub quotify sanitize_identifier); @@ -30,10 +30,7 @@ $Carp::Internal{+__PACKAGE__} = 1; } -my $module_name_only = qr/\A$Module::Runtime::module_name_rx\z/; - -sub _die_overwrite -{ +sub _die_overwrite { my ($pkg, $method, $type) = @_; croak "You cannot overwrite a locally defined method ($method) with " . ( $type || 'an accessor' ); @@ -72,7 +69,7 @@ } $spec->{builder} = '_build_'.$name if ($spec->{builder}||0) eq 1; croak "Invalid builder for $into->$name - not a valid method name" - if $spec->{builder} !~ $module_name_only; + if $spec->{builder} !~ _module_name_rx; } if (($spec->{predicate}||0) eq 1) { $spec->{predicate} = $name =~ /^_/ ? "_has${name}" : "has_${name}"; diff -Nru libmoo-perl-2.004000/lib/Moo/Role.pm libmoo-perl-2.004004/lib/Moo/Role.pm --- libmoo-perl-2.004000/lib/Moo/Role.pm 2020-04-09 15:51:40.000000000 +0000 +++ libmoo-perl-2.004004/lib/Moo/Role.pm 2020-11-25 00:58:08.000000000 +0000 @@ -25,7 +25,7 @@ ); } -our $VERSION = '2.004000'; +our $VERSION = '2.004004'; $VERSION =~ tr/_//d; require Moo::sification; @@ -357,12 +357,12 @@ my $class = ref $new; _set_loaded($class, (caller)[1]); - my $apply_defaults = exists $APPLY_DEFAULTS{$class} ? $APPLY_DEFAULTS{$class} - : $APPLY_DEFAULTS{$class} = do { - my %attrs = map { @{$INFO{$_}{attributes}||[]} } @roles; + my $apply_defaults = $APPLY_DEFAULTS{$class}; + if (!defined $apply_defaults) { + my $attrs = { map @{$INFO{$_}{attributes}||[]}, @roles }; if ($INC{'Moo.pm'} - and keys %attrs + and keys %$attrs and my $con_gen = Moo->_constructor_maker_for($class) and my $m = Moo->_accessor_maker_for($class)) { @@ -386,11 +386,11 @@ else { (); } - } sort keys %attrs ), + } sort keys %$attrs ), ); if ($code) { require Sub::Quote; - Sub::Quote::quote_sub( + $apply_defaults = Sub::Quote::quote_sub( "${class}::_apply_defaults", "no warnings 'void';\n$code", \%captures, @@ -400,14 +400,10 @@ } ); } - else { - 0; - } - } - else { - 0; } - }; + $APPLY_DEFAULTS{$class} = $apply_defaults ||= 0; + } + if ($apply_defaults) { local $Carp::Internal{+__PACKAGE__} = 1; local $Carp::Internal{$class} = 1; diff -Nru libmoo-perl-2.004000/lib/Moo/_Utils.pm libmoo-perl-2.004004/lib/Moo/_Utils.pm --- libmoo-perl-2.004000/lib/Moo/_Utils.pm 2020-04-08 12:03:38.000000000 +0000 +++ libmoo-perl-2.004004/lib/Moo/_Utils.pm 2020-11-21 03:59:30.000000000 +0000 @@ -18,9 +18,15 @@ : $sn ? \&Sub::Name::subname : sub { $_[1] }; *_CAN_SUBNAME = ($su || $sn) ? sub(){1} : sub(){0}; -} -use Module::Runtime qw(use_package_optimistically module_notional_filename); + *_WORK_AROUND_BROKEN_MODULE_STATE = "$]" < 5.009 ? sub(){1} : sub(){0}; + *_WORK_AROUND_HINT_LEAKAGE + = "$]" < 5.011 && !("$]" >= 5.009004 && "$]" < 5.010001) + ? sub(){1} : sub(){0}; + + my $module_name_rx = qr/\A(?!\d)\w+(?:::\w+)*\z/; + *_module_name_rx = sub(){$module_name_rx}; +} use Exporter qw(import); use Config; @@ -42,6 +48,7 @@ _install_tracked _load_module _maybe_load_module + _module_name_rx _name_coderef _set_loaded _unimport_coderefs @@ -88,22 +95,50 @@ _install_coderef("${target}::${name}", "${from}::${name}", $code); } +sub Moo::_Util::__GUARD__::DESTROY { + delete $INC{$_[0]->[0]} if @{$_[0]}; +} + +sub _require { + my ($file) = @_; + my $guard = _WORK_AROUND_BROKEN_MODULE_STATE + && bless([ $file ], 'Moo::_Util::__GUARD__'); + local %^H if _WORK_AROUND_HINT_LEAKAGE; + if (!eval { require $file; 1 }) { + my $e = $@ || "Can't locate $file"; + my $me = __FILE__; + $e =~ s{ at \Q$me\E line \d+\.\n\z}{}; + return $e; + } + pop @$guard if _WORK_AROUND_BROKEN_MODULE_STATE; + return undef; +} + sub _load_module { - my $module = $_[0]; - my $file = eval { module_notional_filename($module) } or croak $@; - use_package_optimistically($module); + my ($module) = @_; + croak qq{"$module" is not a module name!} + unless $module =~ _module_name_rx; + (my $file = "$module.pm") =~ s{::}{/}g; return 1 if $INC{$file}; - my $error = $@ || "Can't locate $file"; + + my $e = _require $file; + return 1 + if !defined $e; + + croak $e + if $e !~ /\ACan't locate \Q$file\E /; # can't just ->can('can') because a sub-package Foo::Bar::Baz # creates a 'Baz::' key in Foo::Bar's symbol table my $stash = _getstash($module)||{}; - return 1 if grep +(ref($_) || *$_{CODE}), values %$stash; + no strict 'refs'; + return 1 if grep +exists &{"${module}::$_"}, grep !/::\z/, keys %$stash; return 1 if $INC{"Moose.pm"} && Class::MOP::class_of($module) or Mouse::Util->can('find_meta') && Mouse::Util::find_meta($module); - croak $error; + + croak $e; } our %MAYBE_LOADED; @@ -111,17 +146,21 @@ my $module = $_[0]; return $MAYBE_LOADED{$module} if exists $MAYBE_LOADED{$module}; - if(! eval { use_package_optimistically($module) }) { - warn "$module exists but failed to load with error: $@"; - } - elsif ( $INC{module_notional_filename($module)} ) { + (my $file = "$module.pm") =~ s{::}{/}g; + + my $e = _require $file; + if (!defined $e) { return $MAYBE_LOADED{$module} = 1; } + elsif ($e !~ /\ACan't locate \Q$file\E /) { + warn "$module exists but failed to load with error: $e"; + } return $MAYBE_LOADED{$module} = 0; } sub _set_loaded { - $INC{Module::Runtime::module_notional_filename($_[0])} ||= $_[1]; + (my $file = "$_[0].pm") =~ s{::}{/}g; + $INC{$file} ||= $_[1]; } sub _install_coderef { diff -Nru libmoo-perl-2.004000/lib/Moo.pm libmoo-perl-2.004004/lib/Moo.pm --- libmoo-perl-2.004000/lib/Moo.pm 2020-04-09 15:51:40.000000000 +0000 +++ libmoo-perl-2.004004/lib/Moo.pm 2020-11-25 00:58:08.000000000 +0000 @@ -24,7 +24,7 @@ ); } -our $VERSION = '2.004000'; +our $VERSION = '2.004004'; $VERSION =~ tr/_//d; require Moo::sification; diff -Nru libmoo-perl-2.004000/maint/Makefile.PL.include libmoo-perl-2.004004/maint/Makefile.PL.include --- libmoo-perl-2.004000/maint/Makefile.PL.include 2020-04-08 08:06:59.000000000 +0000 +++ libmoo-perl-2.004004/maint/Makefile.PL.include 2020-11-20 15:59:52.000000000 +0000 @@ -1,4 +1,4 @@ -BEGIN { -e 'Distar' or system("git clone git://git.shadowcat.co.uk/p5sagit/Distar.git") } +BEGIN { -e 'Distar' or system("git clone https://github.com/p5sagit/Distar.git") } use lib 'Distar/lib'; use Distar 0.001; diff -Nru libmoo-perl-2.004000/Makefile.PL libmoo-perl-2.004004/Makefile.PL --- libmoo-perl-2.004000/Makefile.PL 2020-04-08 08:06:59.000000000 +0000 +++ libmoo-perl-2.004004/Makefile.PL 2020-09-02 10:16:19.000000000 +0000 @@ -24,7 +24,6 @@ runtime => { requires => { 'Class::Method::Modifiers' => '1.10', # for RT#80194 - 'Module::Runtime' => '0.014', # for RT#86394 'Role::Tiny' => '2.001004', 'Scalar::Util' => '1.00', 'perl' => '5.006', diff -Nru libmoo-perl-2.004000/MANIFEST libmoo-perl-2.004004/MANIFEST --- libmoo-perl-2.004000/MANIFEST 2020-04-09 17:57:05.000000000 +0000 +++ libmoo-perl-2.004004/MANIFEST 2020-11-25 00:59:03.000000000 +0000 @@ -86,6 +86,7 @@ t/not-methods.t t/overloaded-coderefs.t t/overridden-core-funcs.t +t/role-conflicts-moox.t t/strictures.t t/sub-and-handles.t t/subconstructor.t diff -Nru libmoo-perl-2.004000/META.json libmoo-perl-2.004004/META.json --- libmoo-perl-2.004000/META.json 2020-04-09 17:57:03.000000000 +0000 +++ libmoo-perl-2.004004/META.json 2020-11-25 00:59:02.000000000 +0000 @@ -4,7 +4,7 @@ "mst - Matt S. Trout (cpan:MSTROUT) " ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.50, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -52,7 +52,6 @@ "requires" : { "Class::Method::Modifiers" : "1.10", "Exporter" : "5.57", - "Module::Runtime" : "0.014", "Role::Tiny" : "2.001004", "Scalar::Util" : "1.00", "Sub::Defer" : "2.006006", @@ -87,7 +86,7 @@ }, "x_IRC" : "irc://irc.perl.org/#moose" }, - "version" : "2.004000", + "version" : "2.004004", "x_authority" : "cpan:MSTROUT", "x_breaks" : { "App::Commando" : "<= 0.012", @@ -103,5 +102,5 @@ "use_warnings" : "internal module used to apply warnings" } }, - "x_serialization_backend" : "JSON::PP version 4.04" + "x_serialization_backend" : "JSON::PP version 4.05" } diff -Nru libmoo-perl-2.004000/META.yml libmoo-perl-2.004004/META.yml --- libmoo-perl-2.004000/META.yml 2020-04-09 17:57:02.000000000 +0000 +++ libmoo-perl-2.004004/META.yml 2020-11-25 00:59:01.000000000 +0000 @@ -8,7 +8,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.50, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -25,7 +25,6 @@ requires: Class::Method::Modifiers: '1.10' Exporter: '5.57' - Module::Runtime: '0.014' Role::Tiny: '2.001004' Scalar::Util: '1.00' Sub::Defer: '2.006006' @@ -36,7 +35,7 @@ bugtracker: https://rt.cpan.org/Public/Dist/Display.html?Name=Moo license: https://dev.perl.org/licenses/ repository: https://github.com/moose/Moo.git -version: '2.004000' +version: '2.004004' x_authority: cpan:MSTROUT x_breaks: App::Commando: '<= 0.012' diff -Nru libmoo-perl-2.004000/t/lib/ErrorLocation.pm libmoo-perl-2.004004/t/lib/ErrorLocation.pm --- libmoo-perl-2.004000/t/lib/ErrorLocation.pm 2020-04-08 08:06:59.000000000 +0000 +++ libmoo-perl-2.004004/t/lib/ErrorLocation.pm 2020-11-24 15:49:23.000000000 +0000 @@ -3,6 +3,7 @@ use Test::Builder; use Carp qw(croak); use Exporter 'import'; +use Carp::Heavy (); our @EXPORT = qw(location_ok); diff -Nru libmoo-perl-2.004000/t/load_module.t libmoo-perl-2.004004/t/load_module.t --- libmoo-perl-2.004000/t/load_module.t 2020-04-08 08:06:59.000000000 +0000 +++ libmoo-perl-2.004004/t/load_module.t 2020-10-28 12:43:20.000000000 +0000 @@ -10,6 +10,13 @@ sub baz { 1 } 1; }, + 'BrokenModule' => q{ + package BrokenModule; + use strict; + sub guff { 1 } + + ;_; + }, ); { package Foo::Bar::Baz; sub quux { } } @@ -18,4 +25,7 @@ ok(eval { Foo::Bar->baz }, 'Loaded module ok'); +ok do { my $e; eval { _load_module("BrokenModule"); 1 } or $e = $@; $e }, + 'broken module that installs subs gives error'; + done_testing; diff -Nru libmoo-perl-2.004000/t/role-conflicts-moox.t libmoo-perl-2.004004/t/role-conflicts-moox.t --- libmoo-perl-2.004000/t/role-conflicts-moox.t 1970-01-01 00:00:00.000000000 +0000 +++ libmoo-perl-2.004004/t/role-conflicts-moox.t 2020-09-02 10:16:19.000000000 +0000 @@ -0,0 +1,43 @@ +use Moo::_strictures; +use Test::More; +use Test::Fatal; + +{ + package MooX::ExtendHas; + BEGIN { $INC{'MooX/ExtendHas.pm'} = __FILE__ } + use Moo::_Utils qw(_install_modifier); + sub import { + my $target = caller; + _install_modifier $target, 'around', 'has', sub { + my $orig = shift; + $orig->(@_); + }; + } +} + +{ + package MyClass; + use Moo; +} + +{ + package MyRole1; + use Moo::Role; + use MooX::ExtendHas; + + has foo => (is => "ro"); +} + +{ + package MyRole2; + use Moo::Role; + use MooX::ExtendHas; + + has bar => (is => "ro"); +} + +is exception { + Moo::Role->create_class_with_roles('MyClass', qw(MyRole1 MyRole2)) +}, undef, "extending has in roles doesn't cause conflicts"; + +done_testing; diff -Nru libmoo-perl-2.004000/xt/inflate-our-classes.t libmoo-perl-2.004004/xt/inflate-our-classes.t --- libmoo-perl-2.004000/xt/inflate-our-classes.t 2020-04-08 08:06:59.000000000 +0000 +++ libmoo-perl-2.004004/xt/inflate-our-classes.t 2020-09-02 10:16:19.000000000 +0000 @@ -3,7 +3,6 @@ use Test::Fatal; use Moo::HandleMoose; -use Module::Runtime qw(use_module); foreach my $class (qw( Method::Generate::Accessor @@ -15,7 +14,9 @@ local $SIG{__WARN__} = sub { push @warnings, $_[0] }; is exception { - Moo::HandleMoose::inject_real_metaclass_for(use_module($class)) + (my $file = "$class.pm") =~ s{::}{/}g; + require $file; + Moo::HandleMoose::inject_real_metaclass_for($class); }, undef, "No exceptions inflating $class"; ok !@warnings, "No warnings inflating $class"