NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
parameterized roles (Score:1)
Alternately, if the "foo" you're overriding there is (as it so often is) something like this:
sub foo_plugins {
return ("My::Foo", "External::Library::Foo");
}
MooseX::Role::Parameterized [cpan.org] might be a good option. e.g.
use MyRole => { foo_plugins => ["My::Foo", "External::Library::Foo" ] };
# elsewhere...
package MyRole;
use MooseX::Role::Parameterized;
parameter foo_plugins => (
isa => 'ArrayRef[ClassName]',
required => 1,
);
role {
my $p = shift;
method munge_stuff => sub {
# do something for each @{$p->foo_plugins}
};
};
Reply to This