Subject: | Problem with applying Moo role with multi-before declaration to Moose class |
The following code fails with this error:
Show quoted text
> Can't use string ("bar") as a subroutine ref while "strict refs" in use at /Users/mmcleric/perl5/perlbrew/perls/perl-5.16.1/lib/site_perl/5.16.3/darwin-2level/Class/MOP/Class.pm line 1079.
Show quoted text> package R1;
> use Moo::Role;
>
> before 'foo', 'bar' => sub {
> print "before\n";
> };
>
> package main;
> use Moose;
> with 'R1';
>
> sub foo {}
> sub bar {}
>
> main->foo;
If I replace "use Moose" with "use Moo", it works as expected.
I'm using the latest versions of all relevant modules: Moo-1.002, Role::Tiny-1.002005, Class::Method::Modifiers-2.04, Moose-2.0802.
My perl version is 5.16.3.