+ - Don't use $_ as loop variable when calling arbitrary code (RT#81072)
+
1.000005 - 2012-10-23
- fix POD typo (RT#80060)
- include init_arg name in constructor errors (RT#79596)
sub _set_superclasses {
my $class = shift;
my $target = shift;
- for (@_) {
- _load_module($_);
- if ($INC{"Role/Tiny.pm"} && $Role::Tiny::INFO{$_}) {
+ foreach my $superclass (@_) {
+ _load_module($superclass);
+ if ($INC{"Role/Tiny.pm"} && $Role::Tiny::INFO{$superclass}) {
require Carp;
- Carp::croak("Can't extend role '$_'");
+ Carp::croak("Can't extend role '$superclass'");
}
}
# Can't do *{...} = \@_ or 5.10.0's mro.pm stops seeing @ISA
sub apply_roles_to_package {
my ($me, $to, @roles) = @_;
- $me->_inhale_if_moose($_) for @roles;
+ foreach my $role (@roles) {
+ $me->_inhale_if_moose($role);
+ }
$me->SUPER::apply_roles_to_package($to, @roles);
}
return $new_name if $Role::Tiny::COMPOSED{class}{$new_name};
- $me->_inhale_if_moose($_) for @roles;
+ foreach my $role (@roles) {
+ $me->_inhale_if_moose($role);
+ }
my $m;
if ($INC{"Moo.pm"}
--- /dev/null
+use strict;
+use warnings;
+use Test::More;
+use lib qw(t/lib);
+
+use_ok('UnderscoreClass');
+
+is(
+ UnderscoreClass->c1,
+ 'c1',
+);
+
+is(
+ UnderscoreClass->r1,
+ 'r1',
+);
+
+is(
+ ClobberUnderscore::h1(),
+ 'h1',
+);
+
+done_testing;
--- /dev/null
+package ClobberUnderscore;
+sub h1 { 'h1' };
+undef $_;
+1;
--- /dev/null
+package UnderscoreClass;
+use Moo;
+with qw(UnderscoreRole);
+sub c1 { 'c1' };
+1;
--- /dev/null
+package UnderscoreRole;
+use Moo::Role;
+use ClobberUnderscore;
+sub r1 { 'r1' };
+1;