1 package Catalyst::Engine::Loader;
3 use Catalyst::Exception;
5 use namespace::autoclean;
7 extends 'Plack::Loader';
9 has application_name => (
16 my ($orig, $self) = (shift, shift);
17 my $engine = $self->$orig(@_);
18 if ($engine eq 'Standalone') {
19 if ( $ENV{MOD_PERL} ) {
20 my ( $software, $version ) =
21 $ENV{MOD_PERL} =~ /^(\S+)\/(\d+(?:[\.\_]\d+)+)/;
23 $version =~ s/(\.[^.]+)\./$1/g;
25 if ( $software eq 'mod_perl' ) {
26 if ( $version >= 1.99922 ) {
30 elsif ( $version >= 1.9901 ) {
31 Catalyst::Exception->throw( message => 'Plack does not have a mod_perl 1.99 handler' );
32 $engine = 'Apache2::MP19';
35 elsif ( $version >= 1.24 ) {
40 Catalyst::Exception->throw( message =>
41 qq/Unsupported mod_perl version: $ENV{MOD_PERL}/ );
47 my $old_engine = Catalyst::Utils::env_value($self->application_name, 'ENGINE');
48 if (!defined $old_engine) { # Not overridden
50 elsif ($old_engine =~ /^(CGI|FCGI|HTTP|Apache.*)$/) {
53 elsif ($old_engine eq "HTTP::Prefork") { # Too bad if you're customising, we don't handle options
54 # write yourself a script to collect and pass in the options
57 elsif ($old_engine eq "HTTP::POE") {
58 Catalyst::Exception->throw("HTTP::POE engine no longer works, recommend you use Twiggy instead");
60 elsif ($old_engine eq "Zeus") {
61 Catalyst::Exception->throw("Zeus engine no longer works");
64 warn("You asked for an unrecognised engine '$old_engine' which is no longer supported, this has been ignored.\n");
70 # Force constructor inlining
71 __PACKAGE__->meta->make_immutable( replace_constructor => 1 );
79 Catalyst::Engine::Loader - The Catalyst Engine Loader
87 Wrapper on L<Plack::Loader> which resets the ::Engine if you are using some
92 Catalyst Contributors, see Catalyst.pm
96 This library is free software. You can redistribute it and/or modify it under
97 the same terms as Perl itself.