X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FLoader.pm;h=0b81933c2f9c40d58a7650b213b1fee2cb8bd715;hp=026a07cd335bc873af1c91f7b0aebfb4864da446;hb=acbecf084395e9b46e607a3fe244faa3c1bd3abb;hpb=5d5f4a737bb6e3ef3c1b4c35ee91d162417b2552 diff --git a/lib/Catalyst/Engine/Loader.pm b/lib/Catalyst/Engine/Loader.pm index 026a07c..0b81933 100644 --- a/lib/Catalyst/Engine/Loader.pm +++ b/lib/Catalyst/Engine/Loader.pm @@ -1,10 +1,17 @@ package Catalyst::Engine::Loader; use Moose; use Catalyst::Exception; +use Catalyst::Utils; use namespace::autoclean; extends 'Plack::Loader'; +has application_name => ( + isa => 'Str', + is => 'ro', + required => 1, +); + around guess => sub { my ($orig, $self) = (shift, shift); my $engine = $self->$orig(@_); @@ -37,10 +44,31 @@ 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.*)$/) { + # Trust autodetect + } + 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"; + } + elsif ($old_engine eq "HTTP::POE") { + Catalyst::Exception->throw("HTTP::POE engine no longer works, recommend you use Twiggy instead"); + } + elsif ($old_engine eq "Zeus") { + Catalyst::Exception->throw("Zeus engine no longer works"); + } + else { + warn("You asked for an unrecognised engine '$old_engine' which is no longer supported, this has been ignored.\n"); + } + return $engine; }; -__PACKAGE__->meta->make_immutable( inline_constructor => 0 ); +# Force constructor inlining +__PACKAGE__->meta->make_immutable( replace_constructor => 1 ); 1;