Help for this page

Select Code to Download


  1. or download this
    use v5.14;
    use strict;
    ...
    my $obj = "MyObject"->new;
    Moose::Util::apply_all_roles($obj, "MyRole");
    say $obj->myattr;
    
  2. or download this
    # Not this...
    default => \&_build_myattr,
    
    # This!
    default => sub { shift->_build_myattr(@_) },