X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngineLoader.pm;h=36cf0168b5b27ef1dfca243cc860911cc14e2719;hb=7ebac5f89810aab16ec76fc28dea45e936172a67;hp=e59135bd7ddbd724afa33447dc8901b757dfa33b;hpb=1085c936f6ea024206a1aee192a87c4c9fc79087;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/EngineLoader.pm b/lib/Catalyst/EngineLoader.pm index e59135b..36cf016 100644 --- a/lib/Catalyst/EngineLoader.pm +++ b/lib/Catalyst/EngineLoader.pm @@ -12,21 +12,16 @@ has application_name => ( required => 1, ); -has compat_options => ( - traits => ['Hash'], - is => 'ro', - isa => 'HashRef', - default => sub { +{} }, - handles => { - has_compat_option => 'exists', - compat_option => 'get', - }, +has requested_engine => ( + is => 'ro', + isa => 'Str', + predicate => 'has_requested_engine', ); sub needs_psgi_engine_compat_hack { my ($self) = @_; - return $self->has_compat_option('requested_engine') - && $self->compat_option('requested_engine') eq 'PSGI'; + return $self->has_requested_engine + && $self->requested_engine eq 'PSGI'; } has catalyst_engine_class => ( @@ -38,11 +33,26 @@ has catalyst_engine_class => ( sub _guess_catalyst_engine_class { my $self = shift; - my $old_engine = Catalyst::Utils::env_value($self->application_name, 'ENGINE'); + my $old_engine = $self->has_requested_engine + ? $self->requested_engine + : Catalyst::Utils::env_value($self->application_name, 'ENGINE'); if (!defined $old_engine) { return 'Catalyst::Engine'; } - elsif ($old_engine =~ /^(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 { @@ -85,9 +95,15 @@ around guess => sub { my $old_engine = Catalyst::Utils::env_value($self->application_name, 'ENGINE'); if (!defined $old_engine) { # Not overridden } - elsif ($old_engine =~ /^(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";