X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=1a7b6729af2b3d4ef16fb427a8d19e23377b0642;hb=91dc9907365d9a8b25836d3c3bf68683af18eb7d;hp=5a9fe8a02560321c7e5a3166ecf5878dfa8f55d4;hpb=937fcdd8a54e8ad8ba7aec296e85905a057cc497;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 5a9fe8a..1a7b672 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -144,11 +144,19 @@ sub import { $caller->log->debug('Debug messages enabled'); } - # Options - my $engine = - $ENV{MOD_PERL} - ? 'Catalyst::Engine::Apache' - : 'Catalyst::Engine::CGI'; + my $engine = 'Catalyst::Engine::CGI'; + + if ( $ENV{MOD_PERL} ) { + + require mod_perl; + + if ( $mod_perl::VERSION >= 1.99 ) { + $engine = 'Catalyst::Engine::Apache::MP2'; + } + else { + $engine = 'Catalyst::Engine::Apache::MP1'; + } + } my @plugins; foreach (@options) { @@ -163,13 +171,13 @@ sub import { else { my $plugin = "Catalyst::Plugin::$_"; - # Plugin caller should be our application class - eval "package $caller; require $plugin"; + $plugin->require; + if ($@) { $caller->log->error(qq/Couldn't load plugin "$plugin", "$@"/); } else { - push @plugins, " $plugin"; + push @plugins, " + $plugin"; no strict 'refs'; push @{"$caller\::ISA"}, $plugin; }