Hi,
I've started to graduate from inheritance to roles and have 2 newbie questions:
1) How do I tweak it such that the ARRAYREF 'strings' is passed to the
foo() method (similar to the native attribute helper Array)? Do I need to wrap
it with a before method provider?
2) If I favor the commented lines instead below and uncomment them, I get:
"foo is an unsupported method type"? what am I missing?
thanks
package TestRole;
use Moose::Role;
sub foo {
my ($self, $args) = @_;
print "hi ho silver!";
}
no Moose::Role;1;
package Test;
use Moose;
use Moose::Util::TypeConstraints;
with 'TestRole';
has 'strings' => (
traits => ['Array', 'TestRole'],
is => 'rw',
isa
=> 'ArrayRef[Str]',
default => sub {[1,2,3,4]},
#handles => { myfoo
=> 'foo' }
);
no Moose;
my $t=Test->new;
$t->foo;
#$t->myfoo;