[Catalyst] setup() called twice

Matt Lawrence matt.lawrence at ymogen.net
Tue Jun 19 16:52:08 GMT 2007


Matt S Trout wrote:
> On Tue, Jun 19, 2007 at 09:50:30AM +0100, Matt Lawrence wrote:
>>
>> What's wrong with:
>>
>> $_->setup for keys %{$self->_plugins};
>>     
>
> Setup order matters.
>
>   

Fine, the order is known in setup(), but gets discarded.

$class->setup_plugins($flags->{plugins});

...

# Call plugins' setup
$_->setup for @{delete $flags->{plugins} || []};

Or if it doesn't matter it this happens earlier in the setup process, it
could be part of setup_plugins.

That way, you call setup once for each plugin, regardless of what
happens to be in @MyApp::ISA.


Matt




More information about the Catalyst mailing list