Skip to content

Instantly share code, notes, and snippets.

@j1n3l0
Created May 26, 2017 16:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j1n3l0/4dc4ec05983748eaf3212185b65d92f8 to your computer and use it in GitHub Desktop.
Save j1n3l0/4dc4ec05983748eaf3212185b65d92f8 to your computer and use it in GitHub Desktop.
use 5.020;
use Test::Most;
package Class {
use Moose;
};
package Role {
use Moose::Role;
sub some_other_method { ... }
};
my $object = new_ok Class => [];
ok( !$object->can('some_method'), 'instance of "Class" cannot handle "some_method"' );
Role->meta->apply( $object, -alias => { some_other_method => 'some_method' } );
ok( $object->can('some_method'), 'instance of "Class" can handle "some_method"' );
done_testing;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment