- or download this
package TestPackage;
use metaclass; # this sets up your class to use Class::MOP
...
my $obj = bless {}, __PACKAGE__;
print 'Can dump()' if $obj->meta->has_method('dump');
- or download this
my @methods = $obj->meta->get_method_list;
- or download this
my @methods = $obj->meta->compute_all_applicable_methods;
- or download this
package MyFooInterface;
use Moose::Role;
requires 'bar';
- or download this
package MyFoo;
use Moose;
...
# the bar method is required, the
# class will fail to compile if it is
# not present
- or download this
my $foo = MyFoo->new;
if ($foo->does('MyFooInterface')) { ... }