X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngineLoader.pm;h=f2b999ae997aac7db23a8ed45075484c468ffa13;hb=50a65bb3660cd8253a592f005cafa2b3768f90fb;hp=3499b508efeceb3e414bba2bd6f6ae308e59ec7d;hpb=b1ededd4680eff1d4ddb42ed860884e361804fe1;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/EngineLoader.pm b/lib/Catalyst/EngineLoader.pm index 3499b50..f2b999a 100644 --- a/lib/Catalyst/EngineLoader.pm +++ b/lib/Catalyst/EngineLoader.pm @@ -12,6 +12,18 @@ has application_name => ( required => 1, ); +has requested_engine => ( + is => 'ro', + isa => 'Str', + predicate => 'has_requested_engine', +); + +sub needs_psgi_engine_compat_hack { + my ($self) = @_; + return $self->has_requested_engine + && $self->requested_engine eq 'PSGI'; +} + has catalyst_engine_class => ( isa => 'Str', is => 'rw', @@ -21,11 +33,13 @@ 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 =~ /^(PSGI|CGI|FastCGI|HTTP|Apache.*)$/) { return 'Catalyst::Engine'; } else { @@ -68,9 +82,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"; @@ -117,4 +137,10 @@ Catalyst Contributors, see Catalyst.pm This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. +=begin Pod::Coverage + +needs_psgi_engine_compat_hack + +=end Pod::Coverage + =cut