1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
use strict;
use warnings;
use Test::More 0.88;
{
package OldMoose;
sub meta { }
sub does { # copied roughly from Moose::Object, pre-2.0300
my ($self, $role_name) = @_;
my $meta = $self->meta;
return 1 if $meta->can('does_role') && $meta->does_role($role_name);
return 0;
}
sub dump {}
}
{
package Foo;
our @ISA = ('OldMoose');
sub bar { }
use namespace::autoclean;
sub moo { }
BEGIN { *kooh = *kooh = do { package Moo; sub { }; }; }
}
ok( Foo->can('bar'), 'Foo can bar - standard method');
ok( Foo->can('moo'), 'Foo can moo - standard method');
ok(!Foo->can('kooh'), 'Foo cannot kooh - anon sub from another package assigned to glob');
ok( Foo->can('dump'), 'Foo can dump - standard method from parent');
done_testing();
|