+ - handles => "RoleName" tries to load the module
+
1.000008 - 2013-02-06
- Re-export on 'use Moo' after 'no Moo'
- Export meta() into roles (but mark as non-method to avoid composing it)
use B 'perlstring';
use Scalar::Util 'blessed';
use overload ();
+use Module::Runtime qw(use_module);
BEGIN {
our $CAN_HAZ_XS =
!$ENV{MOO_XS_DISABLE}
map [ $_ => ref($hspec->{$_}) ? @{$hspec->{$_}} : $hspec->{$_} ],
keys %$hspec;
} elsif (!ref($hspec)) {
- map [ $_ => $_ ], Role::Tiny->methods_provided_by($hspec);
+ map [ $_ => $_ ], use_module('Role::Tiny')->methods_provided_by(use_module($hspec))
} else {
die "You gave me a handles of ${hspec} and I have no idea why";
}
use strictures 1;
use Test::More;
+use lib "t/lib";
+
+{
+ package Baz;
+ use Moo;
+ sub beep {'beep'}
+}
+
{
package Robot;
use Moo::Role;
requires 'smash';
+ $INC{"Robot.pm"} = 1;
}
has foo4 => ( is => 'ro', handles => {
eat_curry => [ yum => 'Curry!' ],
});
+ has foo5 => ( is => 'ro', handles => 'ExtRobot' );
}
my $bar = Bar->new(
- foo => Foo->new, foo2 => Foo->new, foo3 => Foo->new, foo4 => Foo->new
+ foo => Foo->new, foo2 => Foo->new, foo3 => Foo->new, foo4 => Foo->new,
+ foo5 => Baz->new
);
is $bar->one, 1, 'handles works';
is $bar->smash, 'smash', 'handles works for a role';
+is $bar->beep, 'beep', 'handles loads roles';
+
is $bar->eat_curry, 'Curry!', 'handles works for currying';
done_testing;