Help for this page

Select Code to Download


  1. 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');
    
  2. or download this
    my @methods = $obj->meta->get_method_list;
    
  3. or download this
    my @methods = $obj->meta->compute_all_applicable_methods;
    
  4. or download this
    package MyFooInterface;
    use Moose::Role;
    requires 'bar';
    
  5. or download this
    package MyFoo;
    use Moose;
    ...
    # the bar method is required, the 
    # class will fail to compile if it is 
    # not present
    
  6. or download this
    my $foo = MyFoo->new;
    if ($foo->does('MyFooInterface')) { ... }