Hello community, here is the log from the commit of package perl-Moo for openSUSE:Factory checked in at 2020-04-21 13:05:36 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Moo (Old) and /work/SRC/openSUSE:Factory/.perl-Moo.new.2738 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Moo" Tue Apr 21 13:05:36 2020 rev:23 rq:795272 version:2.004000 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Moo/perl-Moo.changes 2019-11-09 23:25:23.639953415 +0100 +++ /work/SRC/openSUSE:Factory/.perl-Moo.new.2738/perl-Moo.changes 2020-04-21 13:05:36.320206539 +0200 @@ -1,0 +2,17 @@ +Fri Apr 10 03:12:51 UTC 2020 - <[email protected]> + +- updated to 2.004000 + see /usr/share/doc/packages/perl-Moo/Changes + + 2.004000 - 2020-04-09 + - minor documentation tweaks + - minor test tweaks + - refactor creation and installation of helper subs allowing extensions to + customize the behavior easier. + - added is_class and make_class methods to Moo + - added make_role method to Moo::Role + - lower Scalar::Util dependency to 1.00 + - fix unlikely failure to properly inflate Type::Tiny types to Moose under + threads on perl 5.8 + +------------------------------------------------------------------- Old: ---- Moo-2.003006.tar.gz New: ---- Moo-2.004000.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Moo.spec ++++++ --- /var/tmp/diff_new_pack.WiDyyc/_old 2020-04-21 13:05:36.836207569 +0200 +++ /var/tmp/diff_new_pack.WiDyyc/_new 2020-04-21 13:05:36.848207593 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Moo # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: perl-Moo -Version: 2.003006 +Version: 2.004000 Release: 0 %define cpan_name Moo Summary: Minimalist Object Orientation (with Moose compatibility) ++++++ Moo-2.003006.tar.gz -> Moo-2.004000.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/Changes new/Moo-2.004000/Changes --- old/Moo-2.003006/Changes 2019-10-25 13:20:49.000000000 +0200 +++ new/Moo-2.004000/Changes 2020-04-09 19:56:16.000000000 +0200 @@ -1,5 +1,16 @@ Revision history for Moo +2.004000 - 2020-04-09 + - minor documentation tweaks + - minor test tweaks + - refactor creation and installation of helper subs allowing extensions to + customize the behavior easier. + - added is_class and make_class methods to Moo + - added make_role method to Moo::Role + - lower Scalar::Util dependency to 1.00 + - fix unlikely failure to properly inflate Type::Tiny types to Moose under + threads on perl 5.8 + 2.003006 - 2019-10-25 - update Role::Tiny prerequisite to 2.001004 to fix issues with re-importing Moo::Role diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/LICENSE new/Moo-2.004000/LICENSE --- old/Moo-2.003006/LICENSE 2019-10-25 13:21:38.000000000 +0200 +++ new/Moo-2.004000/LICENSE 2020-04-09 19:57:05.000000000 +0200 @@ -7,7 +7,7 @@ --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2019 by mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>. +This software is Copyright (c) 2020 by mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>. This is free software, licensed under: @@ -267,7 +267,7 @@ --- The Artistic License 1.0 --- -This software is Copyright (c) 2019 by mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>. +This software is Copyright (c) 2020 by mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>. This is free software, licensed under: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/META.json new/Moo-2.004000/META.json --- old/Moo-2.003006/META.json 2019-10-25 13:21:38.000000000 +0200 +++ new/Moo-2.004000/META.json 2020-04-09 19:57:03.000000000 +0200 @@ -4,7 +4,7 @@ "mst - Matt S. Trout (cpan:MSTROUT) <[email protected]>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter version 2.150010", + "generated_by" : "ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -54,7 +54,7 @@ "Exporter" : "5.57", "Module::Runtime" : "0.014", "Role::Tiny" : "2.001004", - "Scalar::Util" : "1.09", + "Scalar::Util" : "1.00", "Sub::Defer" : "2.006006", "Sub::Quote" : "2.006006", "perl" : "5.006" @@ -87,7 +87,7 @@ }, "x_IRC" : "irc://irc.perl.org/#moose" }, - "version" : "2.003006", + "version" : "2.004000", "x_authority" : "cpan:MSTROUT", "x_breaks" : { "App::Commando" : "<= 0.012", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/META.yml new/Moo-2.004000/META.yml --- old/Moo-2.003006/META.yml 2019-10-25 13:21:37.000000000 +0200 +++ new/Moo-2.004000/META.yml 2020-04-09 19:57:02.000000000 +0200 @@ -8,7 +8,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter version 2.150010' +generated_by: 'ExtUtils::MakeMaker version 7.44, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -27,7 +27,7 @@ Exporter: '5.57' Module::Runtime: '0.014' Role::Tiny: '2.001004' - Scalar::Util: '1.09' + Scalar::Util: '1.00' Sub::Defer: '2.006006' Sub::Quote: '2.006006' perl: '5.006' @@ -36,7 +36,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.003006' +version: '2.004000' x_authority: cpan:MSTROUT x_breaks: App::Commando: '<= 0.012' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/Makefile.PL new/Moo-2.004000/Makefile.PL --- old/Moo-2.003006/Makefile.PL 2019-10-25 13:18:14.000000000 +0200 +++ new/Moo-2.004000/Makefile.PL 2020-04-08 10:06:59.000000000 +0200 @@ -26,7 +26,7 @@ 'Class::Method::Modifiers' => '1.10', # for RT#80194 'Module::Runtime' => '0.014', # for RT#86394 'Role::Tiny' => '2.001004', - 'Scalar::Util' => '1.09', + 'Scalar::Util' => '1.00', 'perl' => '5.006', 'Exporter' => '5.57', # Import 'import' 'Sub::Quote' => '2.006006', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/README new/Moo-2.004000/README --- old/Moo-2.003006/README 2019-10-25 13:21:38.000000000 +0200 +++ new/Moo-2.004000/README 2020-04-09 19:57:04.000000000 +0200 @@ -730,6 +730,18 @@ An extension MooX::late exists to ease translating Moose packages to Moo by providing a more Moose-like interface. +COMPATIBILITY WITH OLDER PERL VERSIONS + Moo is compatible with perl versions back to 5.6. When running on older + versions, additional prerequisites will be required. If you are + packaging a script with its dependencies, such as with App::FatPacker, + you will need to be certain that the extra prerequisites are included. + + MRO::Compat + Required on perl versions prior to 5.10.0. + + Devel::GlobalDestruction + Required on perl versions prior to 5.14.0. + SUPPORT IRC: #moose on irc.perl.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/lib/Moo/HandleMoose/_TypeMap.pm new/Moo-2.004000/lib/Moo/HandleMoose/_TypeMap.pm --- old/Moo-2.003006/lib/Moo/HandleMoose/_TypeMap.pm 2019-09-06 15:03:59.000000000 +0200 +++ new/Moo-2.004000/lib/Moo/HandleMoose/_TypeMap.pm 2020-04-09 17:45:06.000000000 +0200 @@ -8,7 +8,11 @@ package Moo::HandleMoose::_TypeMap; use Scalar::Util (); -use Config; +use Config (); + +BEGIN { + *_OVERLOAD_ON_REF = "$]" < 5.010000 ? sub(){1} : sub(){0}; +} our %WEAK_TYPES; @@ -23,12 +27,20 @@ require B; my $sv = bless \$id, 'B::SV'; my $ref = eval { $sv->object_2svref }; + if (!defined $ref or Scalar::Util::reftype($ref) ne $type) { die <<'END_ERROR'; Moo initialization encountered types defined in a parent thread - ensure that Moo is require()d before any further thread spawns following a type definition. END_ERROR } + + # on older perls where overloading magic is attached to the ref rather + # than the ref target, reblessing will pick up the magic + if (_OVERLOAD_ON_REF and my $class = Scalar::Util::blessed($ref)) { + bless $ref, $class; + } + return $ref; } return $in; @@ -39,8 +51,9 @@ sub STORE { my ($self, $key, $value) = @_; my $type = _str_to_ref($key); - $WEAK_TYPES{$type} = $type; - Scalar::Util::weaken($WEAK_TYPES{$type}) + $key = "$type"; + $WEAK_TYPES{$key} = $type; + Scalar::Util::weaken($WEAK_TYPES{$key}) if ref $type; $self->{$key} = $value; } @@ -67,7 +80,7 @@ %TYPE_MAP = %types; } -if ($Config{useithreads}) { +if ($Config::Config{useithreads}) { my @types = %TYPE_MAP; tie %TYPE_MAP, __PACKAGE__; %TYPE_MAP = @types; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/lib/Moo/Role.pm new/Moo-2.004000/lib/Moo/Role.pm --- old/Moo-2.003006/lib/Moo/Role.pm 2019-10-25 13:20:32.000000000 +0200 +++ new/Moo-2.004000/lib/Moo/Role.pm 2020-04-09 17:51:40.000000000 +0200 @@ -25,7 +25,7 @@ ); } -our $VERSION = '2.003006'; +our $VERSION = '2.004000'; $VERSION =~ tr/_//d; require Moo::sification; @@ -63,38 +63,50 @@ sub _install_subs { my ($me, $target) = @_; - _install_tracked $target => has => sub { - my $name_proto = shift; - my @name_proto = ref $name_proto eq 'ARRAY' ? @$name_proto : $name_proto; - if (@_ % 2 != 0) { - croak("Invalid options for " . join(', ', map "'$_'", @name_proto) - . " attribute(s): even number of arguments expected, got " . scalar @_) - } - my %spec = @_; - foreach my $name (@name_proto) { - my $spec_ref = @name_proto > 1 ? +{%spec} : \%spec; - $me->_accessor_maker_for($target) - ->generate_method($target, $name, $spec_ref); - push @{$INFO{$target}{attributes}||=[]}, $name, $spec_ref; + my %install = $me->_gen_subs($target); + _install_tracked $target => $_ => $install{$_} + for sort keys %install; + *{_getglob("${target}::meta")} = $me->can('meta'); + return; +} + +sub _gen_subs { + my ($me, $target) = @_; + return ( + has => sub { + my $name_proto = shift; + my @name_proto = ref $name_proto eq 'ARRAY' ? @$name_proto : $name_proto; + if (@_ % 2 != 0) { + croak("Invalid options for " . join(', ', map "'$_'", @name_proto) + . " attribute(s): even number of arguments expected, got " . scalar @_) + } + my %spec = @_; + foreach my $name (@name_proto) { + my $spec_ref = @name_proto > 1 ? +{%spec} : \%spec; + $me->_accessor_maker_for($target) + ->generate_method($target, $name, $spec_ref); + push @{$INFO{$target}{attributes}||=[]}, $name, $spec_ref; + $me->_maybe_reset_handlemoose($target); + } + }, + (map { + my $type = $_; + ( + $type => sub { + push @{$INFO{$target}{modifiers}||=[]}, [ $type => @_ ]; + $me->_maybe_reset_handlemoose($target); + }, + ) + } qw(before after around)), + requires => sub { + push @{$INFO{$target}{requires}||=[]}, @_; $me->_maybe_reset_handlemoose($target); - } - }; - # install before/after/around subs - foreach my $type (qw(before after around)) { - _install_tracked $target => $type => sub { - push @{$INFO{$target}{modifiers}||=[]}, [ $type => @_ ]; + }, + with => sub { + $me->apply_roles_to_package($target, @_); $me->_maybe_reset_handlemoose($target); - }; - } - _install_tracked $target => requires => sub { - push @{$INFO{$target}{requires}||=[]}, @_; - $me->_maybe_reset_handlemoose($target); - }; - _install_tracked $target => with => sub { - $me->apply_roles_to_package($target, @_); - $me->_maybe_reset_handlemoose($target); - }; - *{_getglob("${target}::meta")} = $me->can('meta'); + }, + ); } push @ON_ROLE_CREATE, sub { @@ -497,7 +509,7 @@ use strictures 2; # bar gets imported, but not foo - with('My::Role'); + with 'My::Role'; sub foo { ... } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/lib/Moo.pm new/Moo-2.004000/lib/Moo.pm --- old/Moo-2.003006/lib/Moo.pm 2019-10-25 13:20:32.000000000 +0200 +++ new/Moo-2.004000/lib/Moo.pm 2020-04-09 17:51:40.000000000 +0200 @@ -13,7 +13,6 @@ _set_loaded _unimport_coderefs ); -use Scalar::Util qw(reftype); use Carp qw(croak); BEGIN { our @CARP_NOT = qw( @@ -25,7 +24,7 @@ ); } -our $VERSION = '2.003006'; +our $VERSION = '2.004000'; $VERSION =~ tr/_//d; require Moo::sification; @@ -36,62 +35,35 @@ sub import { my $target = caller; my $class = shift; + if ($INC{'Role/Tiny.pm'} and Role::Tiny->is_role($target)) { + croak "Cannot import Moo into a role"; + } + _set_loaded(caller); strict->import; warnings->import; - if ($INC{'Role/Tiny.pm'} and Role::Tiny->is_role($target)) { - croak "Cannot import Moo into a role"; - } - $MAKERS{$target} ||= {}; - _install_tracked $target => extends => sub { - $class->_set_superclasses($target, @_); - $class->_maybe_reset_handlemoose($target); - return; - }; - _install_tracked $target => with => sub { - require Moo::Role; - Moo::Role->apply_roles_to_package($target, @_); - $class->_maybe_reset_handlemoose($target); - }; - _install_tracked $target => has => sub { - my $name_proto = shift; - my @name_proto = ref $name_proto eq 'ARRAY' ? @$name_proto : $name_proto; - if (@_ % 2 != 0) { - croak "Invalid options for " . join(', ', map "'$_'", @name_proto) - . " attribute(s): even number of arguments expected, got " . scalar @_; - } - my %spec = @_; - foreach my $name (@name_proto) { - # Note that when multiple attributes specified, each attribute - # needs a separate \%specs hashref - my $spec_ref = @name_proto > 1 ? +{%spec} : \%spec; - $class->_constructor_maker_for($target) - ->register_attribute_specs($name, $spec_ref); - $class->_accessor_maker_for($target) - ->generate_method($target, $name, $spec_ref); - $class->_maybe_reset_handlemoose($target); - } - return; - }; - foreach my $type (qw(before after around)) { - _install_tracked $target => $type => sub { - _install_modifier($target, $type, @_); - return; - }; - } - return if $MAKERS{$target}{is_class}; # already exported into this package + $class->_install_subs($target, @_); + $class->make_class($target); + return; +} + +sub make_class { + my ($me, $target) = @_; + + my $makers = $MAKERS{$target} ||= {}; + return $target if $makers->{is_class}; my $stash = _getstash($target); - $MAKERS{$target}{non_methods} = { + $makers->{non_methods} = { map +($_ => \&{"${target}::${_}"}), grep exists &{"${target}::${_}"}, grep !/::\z/ && !/\A\(/, keys %$stash }; - $MAKERS{$target}{is_class} = 1; + $makers->{is_class} = 1; { no strict 'refs'; @{"${target}::ISA"} = do { @@ -101,6 +73,65 @@ if ($INC{'Moo/HandleMoose.pm'} && !$Moo::sification::disabled) { Moo::HandleMoose::inject_fake_metaclass_for($target); } + return $target; +} + +sub is_class { + my ($me, $class) = @_; + return $MAKERS{$class} && $MAKERS{$class}{is_class}; +} + +sub _install_subs { + my ($me, $target) = @_; + my %install = $me->_gen_subs($target); + _install_tracked $target => $_ => $install{$_} + for sort keys %install; + return; +} + +sub _gen_subs { + my ($me, $target) = @_; + return ( + extends => sub { + $me->_set_superclasses($target, @_); + $me->_maybe_reset_handlemoose($target); + return; + }, + with => sub { + require Moo::Role; + Moo::Role->apply_roles_to_package($target, @_); + $me->_maybe_reset_handlemoose($target); + }, + has => sub { + my $name_proto = shift; + my @name_proto = ref $name_proto eq 'ARRAY' ? @$name_proto : $name_proto; + if (@_ % 2 != 0) { + croak "Invalid options for " . join(', ', map "'$_'", @name_proto) + . " attribute(s): even number of arguments expected, got " . scalar @_; + } + my %spec = @_; + foreach my $name (@name_proto) { + # Note that when multiple attributes specified, each attribute + # needs a separate \%specs hashref + my $spec_ref = @name_proto > 1 ? +{%spec} : \%spec; + $me->_constructor_maker_for($target) + ->register_attribute_specs($name, $spec_ref); + $me->_accessor_maker_for($target) + ->generate_method($target, $name, $spec_ref); + $me->_maybe_reset_handlemoose($target); + } + return; + }, + (map { + my $type = $_; + ( + $type => sub { + _install_modifier($target, $type, @_); + return; + }, + ) + } qw(before after around)), + ); } sub unimport { @@ -145,17 +176,17 @@ return unless $MAKERS{$target}; $MAKERS{$target}{accessor} ||= do { my $maker_class = do { + no strict 'refs'; if (my $m = do { - require Sub::Defer; - if (my $defer_target = - (Sub::Defer::defer_info($target->can('new'))||[])->[0] - ) { - my ($pkg) = ($defer_target =~ /^(.*)::[^:]+$/); - $MAKERS{$pkg} && $MAKERS{$pkg}{accessor}; - } else { - undef; - } - }) { + my @isa = @{mro::get_linear_isa($target)}; + shift @isa; + if (my ($parent_new) = grep +(defined &{$_.'::new'}), @isa) { + $MAKERS{$parent_new} && $MAKERS{$parent_new}{accessor}; + } + else { + undef; + } + }) { ref($m); } else { require Method::Generate::Accessor; @@ -1039,6 +1070,25 @@ An extension L<MooX::late> exists to ease translating Moose packages to Moo by providing a more Moose-like interface. +=head1 COMPATIBILITY WITH OLDER PERL VERSIONS + +Moo is compatible with perl versions back to 5.6. When running on older +versions, additional prerequisites will be required. If you are packaging a +script with its dependencies, such as with L<App::FatPacker>, you will need to +be certain that the extra prerequisites are included. + +=over 4 + +=item L<MRO::Compat> + +Required on perl versions prior to 5.10.0. + +=item L<Devel::GlobalDestruction> + +Required on perl versions prior to 5.14.0. + +=back + =head1 SUPPORT IRC: #moose on irc.perl.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/t/accessor-weaken.t new/Moo-2.004000/t/accessor-weaken.t --- old/Moo-2.003006/t/accessor-weaken.t 2019-09-06 15:03:59.000000000 +0200 +++ new/Moo-2.004000/t/accessor-weaken.t 2020-04-08 10:49:03.000000000 +0200 @@ -1,6 +1,7 @@ use Moo::_strictures; use Test::More; use Moo::_Utils (); +use Scalar::Util (); note "pretending to be pre-5.8.3" if $ENV{MOO_TEST_PRE_583}; @@ -26,6 +27,7 @@ my $foo = Foo->new(one => $ref); is($foo->one, $ref, 'value present'); ok(Scalar::Util::isweak($foo->{one}), 'value weakened'); +is($foo->one($ref), $ref, 'value returned from setter'); undef $ref; ok(!defined $foo->{one}, 'weak value gone'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/t/overloaded-coderefs.t new/Moo-2.004000/t/overloaded-coderefs.t --- old/Moo-2.003006/t/overloaded-coderefs.t 2019-09-06 15:03:59.000000000 +0200 +++ new/Moo-2.004000/t/overloaded-coderefs.t 2020-04-08 10:06:59.000000000 +0200 @@ -58,15 +58,15 @@ require Scalar::Util; is( - Scalar::Util::refaddr($luke), - Scalar::Util::refaddr( + 0+$luke, + 0+( Moo->_constructor_maker_for("Doubleena")->all_attribute_specs->{"b"}{"isa"} ), '$spec->{isa} reference is not mutated', ); is( - Scalar::Util::refaddr($theforce), - Scalar::Util::refaddr( + 0+$theforce, + 0+( Moo->_constructor_maker_for("Doubleena")->all_attribute_specs->{"b"}{"coerce"} ), '$spec->{coerce} reference is not mutated', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/xt/handle_moose.t new/Moo-2.004000/xt/handle_moose.t --- old/Moo-2.003006/xt/handle_moose.t 2019-09-06 15:03:59.000000000 +0200 +++ new/Moo-2.004000/xt/handle_moose.t 2020-04-08 10:06:59.000000000 +0200 @@ -81,11 +81,11 @@ { package WithNonMethods; - use Scalar::Util qw(looks_like_number); + use Scalar::Util qw(reftype); use Moo; my $meta = Class::MOP::get_metaclass_by_name(__PACKAGE__); - ::ok(!$meta->has_method('looks_like_number'), + ::ok(!$meta->has_method('reftype'), 'imported sub before use Moo not included in inflated metaclass'); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/xt/moo-roles-into-moose-class.t new/Moo-2.004000/xt/moo-roles-into-moose-class.t --- old/Moo-2.003006/xt/moo-roles-into-moose-class.t 2019-09-06 15:03:59.000000000 +0200 +++ new/Moo-2.004000/xt/moo-roles-into-moose-class.t 2020-04-08 10:06:59.000000000 +0200 @@ -22,10 +22,12 @@ { package Baz; use Moose; + + with 'Bar'; + no Moose; ::ok(!__PACKAGE__->can('has'), 'No has function after no Moose;'); - Moose::with('Baz', 'Bar'); } ::is(Baz->can('thing'), Bar->can('thing'), 'Role copies method correctly'); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Moo-2.003006/xt/type-inflate-threads.t new/Moo-2.004000/xt/type-inflate-threads.t --- old/Moo-2.003006/xt/type-inflate-threads.t 2019-09-06 15:03:59.000000000 +0200 +++ new/Moo-2.004000/xt/type-inflate-threads.t 2020-04-09 17:45:06.000000000 +0200 @@ -10,6 +10,28 @@ use Test::More; use Type::Tiny; +{ + package TestTTProxy; + use overload + q{""} => sub { + # construct a "normal" looking stringified ref that represents the same + # number, but is formatted differently so it won't match the same string + my $ref_str = overload::AddrRef($_[0]); + $ref_str =~ s/0x/0x0000/; + $ref_str; + }, + q{bool} => sub () { 1 }, + q{&{}} => sub { my $tt = $_[0]->{tt}; sub { $tt->assert_valid($_[0]) } }, + fallback => 1, + ; + sub new { + my ($class, $tt) = @_; + my $self = bless { tt => $tt }, $class; + $Moo::HandleMoose::TYPE_MAP{$self} = sub { $tt }; + return $self; + } +} + my $str = sub { die unless defined $_[0] && !ref $_[0]; }; @@ -23,6 +45,9 @@ constraint => sub { /^(?:-?[1-9][0-9]*|0)$|/ }, message => sub { "$_ isn't an integer" }, ); + +my $int_proxy = TestTTProxy->new($int); + require Moo; is(threads->create(sub { @@ -61,4 +86,22 @@ $int_class; })->join, 'Type::Tiny', 'Type::Tiny created outside thread inflates to self'); +is(threads->create(sub { + my $type = $int_proxy; + eval q{ + package TypeOMatic; + use Moo; + has int_type => ( + is => 'ro', + isa => $type, + ); + 1; + } or die $@; + + require Moose; + my $meta = Class::MOP::class_of('TypeOMatic'); + my $int_class = ref $meta->get_attribute("int_type")->type_constraint; + $int_class; +})->join, 'Type::Tiny', 'Overloaded object inflates to correct type'); + done_testing;
