[Catalyst] Plugin conflict?
Jim Spath
jspath at pangeamedia.com
Thu May 31 20:41:49 GMT 2007
Matt S Trout wrote:
>> PS - On a side note, is it possible to change which plugins are loaded
>> depending on whether Catalyst is launched from myapp_server.pl or
>> myapp_fastcgi.pl? This would be helpful...
>
> in MyApp.pm
>
> sub setup_plugins {
> my ($class, $plugins_arrayref) = @_;
> <do something based on $class->engine>
> $class->next::method($plugins_arrayref);
> }
FYI, here is how I ended up writing this:
sub setup_plugins {
my ($c, $plugins_arrayref) = @_;
if ($c->engine_class) {
if ($c->engine_class eq 'Catalyst::Engine::CGI') {
push @$plugins_arrayref, 'Static::Simple';
} elsif ($c->engine_class eq 'Catalyst::Engine::FastCGI') {
push @$plugins_arrayref, 'Compress::Deflate';
}
}
$c->NEXT::setup_plugins($plugins_arrayref);
}
I try not to muck around too much with this stuff unless I have to, so
it took me a little while to figure exactly how to write this.
Thanks again Matt!
- Jim
More information about the Catalyst
mailing list