X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FRole%2FTiny.pm;h=9a3ce290a94bb7e9b13c75caefcc74424d2cd53e;hb=667f4e70c519db70d01331d4fe4c33d94740e60a;hp=3062e65562e24031245c960ca5f1380de7e6f808;hpb=76acfa6c8aca484921a7fd50332d85e366d2b30a;p=gitmo%2FRole-Tiny.git diff --git a/lib/Role/Tiny.pm b/lib/Role/Tiny.pm index 3062e65..9a3ce29 100644 --- a/lib/Role/Tiny.pm +++ b/lib/Role/Tiny.pm @@ -6,7 +6,7 @@ sub _getstash { \%{"$_[0]::"} } use strict; use warnings FATAL => 'all'; -our $VERSION = '1.002002'; # 1.2.2 +our $VERSION = '1.002004'; # 1.2.4 $VERSION = eval $VERSION; our %INFO; @@ -190,14 +190,18 @@ sub apply_roles_to_package { delete $INFO{$to}{methods}; # reset since we're about to add methods } - $me->apply_role_to_package($to, $_) for @roles; + foreach my $role (@roles) { + $me->apply_single_role_to_package($to, $role); + } $APPLIED_TO{$to}{join('|',@roles)} = 1; } sub _composite_info_for { my ($me, @roles) = @_; $COMPOSITE_INFO{join('|', sort @roles)} ||= do { - _load_module($_) for @roles; + foreach my $role (@roles) { + _load_module($role); + } my %methods; foreach my $role (@roles) { my $this_methods = $me->_concrete_methods_of($role); @@ -214,7 +218,11 @@ sub _composable_package_for { return $composed_name if $COMPOSED{role}{$composed_name}; $me->_install_methods($composed_name, $role); my $base_name = $composed_name.'::_BASE'; - *{_getglob("${composed_name}::ISA")} = [ $base_name ]; + # Not using _getglob, since setting @ISA via the typeglob breaks + # inheritance on 5.10.0 if the stash has previously been accessed an + # then a method called on the class (in that order!), which + # ->_install_methods (with the help of ->_install_does) ends up doing. + { no strict 'refs'; @{"${composed_name}::ISA"} = ( $base_name ); } my $modifiers = $INFO{$role}{modifiers}||[]; my @mod_base; foreach my $modified (