use strict;
use warnings FATAL => 'all';
-our $VERSION = '1.002002'; # 1.2.2
+our $VERSION = '1.002005'; # 1.2.5
$VERSION = eval $VERSION;
our %INFO;
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);
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 (
map {
my $code = *{$stash->{$_}}{CODE};
# rely on the '' key we added in import for "no code here"
- exists $not_methods->{$code||''} ? () : ($_ => $code)
+ ( ! $code or exists $not_methods->{$code||''} ) ? () : ($_ => $code)
} grep !ref($stash->{$_}), keys %$stash
};
}
}
}
+my $vcheck_error;
+
sub _install_single_modifier {
my ($me, @args) = @_;
+ defined($vcheck_error) or $vcheck_error = do {
+ local $@;
+ eval { Class::Method::Modifiers->VERSION(1.05); 1 }
+ ? 0
+ : $@
+ };
+ $vcheck_error and die $vcheck_error;
Class::Method::Modifiers::install_modifier(@args);
}
1;
+=encoding utf-8
+
=head1 NAME
Role::Tiny - Roles. Like a nouvelle cuisine portion size slice of Moose.