X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngineLoader.pm;h=b93fb486b3b8c608dbcd08ef69980795d5887191;hp=b48022ec97e82d9c3d3af757aab603adb506f1fc;hb=88e5a8b0c4d28e46b8ba6b6b9567063e57af9063;hpb=830ca4999a50ffdf785bbdd390967d6419e5fa62 diff --git a/lib/Catalyst/EngineLoader.pm b/lib/Catalyst/EngineLoader.pm index b48022e..b93fb48 100644 --- a/lib/Catalyst/EngineLoader.pm +++ b/lib/Catalyst/EngineLoader.pm @@ -2,7 +2,7 @@ package Catalyst::EngineLoader; use Moose; use Catalyst::Exception; use Catalyst::Utils; -use namespace::autoclean; +use namespace::clean -except => ['meta']; extends 'Plack::Loader'; @@ -39,7 +39,20 @@ sub _guess_catalyst_engine_class { if (!defined $old_engine) { return 'Catalyst::Engine'; } - elsif ($old_engine =~ /^(PSGI|CGI|FCGI|HTTP|Apache.*)$/) { + elsif ($old_engine eq 'PSGI') { + ## If we are running under plackup let the Catalyst::Engine::PSGI + ## continue to run, but warn. + warn <<"EOW"; +You are running Catalyst::Engine::PSGI, which is considered a legacy engine for +this version of Catalyst. We will continue running and use your existing psgi +file, but it is recommended to perform the trivial upgrade process, which will +leave you with less code and a forward path. + +Please review Catalyst::Upgrading +EOW + return 'Catalyst::Engine::' . $old_engine; + } + elsif ($old_engine =~ /^(CGI|FastCGI|HTTP|Apache.*)$/) { return 'Catalyst::Engine'; } else { @@ -50,31 +63,29 @@ sub _guess_catalyst_engine_class { around guess => sub { my ($orig, $self) = (shift, shift); my $engine = $self->$orig(@_); - if ($engine eq 'Standalone') { - if ( $ENV{MOD_PERL} ) { - my ( $software, $version ) = - $ENV{MOD_PERL} =~ /^(\S+)\/(\d+(?:[\.\_]\d+)+)/; - $version =~ s/_//g; - $version =~ s/(\.[^.]+)\./$1/g; - - if ( $software eq 'mod_perl' ) { - if ( $version >= 1.99922 ) { - $engine = 'Apache2'; - } - - elsif ( $version >= 1.9901 ) { - Catalyst::Exception->throw( message => 'Plack does not have a mod_perl 1.99 handler' ); - $engine = 'Apache2::MP19'; - } - - elsif ( $version >= 1.24 ) { - $engine = 'Apache1'; - } - - else { - Catalyst::Exception->throw( message => - qq/Unsupported mod_perl version: $ENV{MOD_PERL}/ ); - } + if ( $ENV{MOD_PERL} ) { + my ( $software, $version ) = + $ENV{MOD_PERL} =~ /^(\S+)\/(\d+(?:[\.\_]\d+)+)/; + $version =~ s/_//g; + $version =~ s/(\.[^.]+)\./$1/g; + + if ( $software eq 'mod_perl' ) { + if ( $version >= 1.99922 ) { + $engine = 'Apache2'; + } + + elsif ( $version >= 1.9901 ) { + Catalyst::Exception->throw( message => 'Plack does not have a mod_perl 1.99 handler' ); + $engine = 'Apache2::MP19'; + } + + elsif ( $version >= 1.24 ) { + $engine = 'Apache1'; + } + + else { + Catalyst::Exception->throw( message => + qq/Unsupported mod_perl version: $ENV{MOD_PERL}/ ); } } } @@ -82,9 +93,15 @@ around guess => sub { my $old_engine = Catalyst::Utils::env_value($self->application_name, 'ENGINE'); if (!defined $old_engine) { # Not overridden } - elsif ($old_engine =~ /^(PSGI|CGI|FCGI|HTTP|Apache.*)$/) { + elsif ($old_engine =~ /^(PSGI|CGI|Apache.*)$/) { # Trust autodetect } + elsif ($old_engine eq 'HTTP') { + $engine = 'Standalone'; + } + elsif ($old_engine eq 'FastCGI') { + $engine = 'FCGI'; + } elsif ($old_engine eq "HTTP::Prefork") { # Too bad if you're customising, we don't handle options # write yourself a script to collect and pass in the options $engine = "Starman";