Subject: | Allow plugins to be installed at instantiation |
Hi,
Thanks for the releasing this module, since I use it quite a bit and it
has helped to make my code better. One thing that I personally do often
is want to be able to load plugins at instantiation time. For example,
I often want:
my $decorated = MyDecorator->new({
wraps=>$object,
plugins=>[qw/Autoload/]);
So that the $decorated object already loads some plugins. I want this
often enough that I created a role that does:
has 'plugins' => (
is=>'rw',
isa=>'ArrayRef',
auto_deref=>1,
trigger=>sub {
my ($self) = @_;
foreach my $plugin ($self->plugins)
{
$self->load_plugin($plugin);
}
},
);
To support the above. If you think a feature like this is valuable I'd
be happy to fix it up with some tests and submit you a patch. I'd also
appreciate your feedback about the feature and what could make it
better. I understand your concern about polluting the caller's
namespace, for example.
Thanks!
John Napiorkowski