fixed running unnder http server test failure and added some pod
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / Loader.pm
CommitLineData
532f0516 1package Catalyst::Engine::Loader;
2use Moose;
3use Catalyst::Exception;
4use namespace::autoclean;
5
6extends 'Plack::Loader';
7
8around guess => sub {
9 my ($orig, $self) = (shift, shift);
10 my $engine = $self->$orig(@_);
11 if ($engine eq 'Standalone') {
12 if ( $ENV{MOD_PERL} ) {
13 my ( $software, $version ) =
14 $ENV{MOD_PERL} =~ /^(\S+)\/(\d+(?:[\.\_]\d+)+)/;
15
16 $version =~ s/_//g;
17 if ( $software eq 'mod_perl' ) {
18 if ( $version >= 1.99922 ) {
19 $engine = 'Apache2';
20 }
21
22 elsif ( $version >= 1.9901 ) {
23 Catalyst::Exception->throw( message => 'Plack does not have a mod_perl 1.99 handler' );
24 $engine = 'Apache2::MP19';
25 }
26
27 elsif ( $version >= 1.24 ) {
28 $engine = 'Apache1';
29 }
30
31 else {
32 Catalyst::Exception->throw( message =>
33 qq/Unsupported mod_perl version: $ENV{MOD_PERL}/ );
34 }
35 }
36 }
37 }
38 return $engine;
39};
40
41__PACKAGE__->meta->make_immutable( inline_constructor => 0 );
df1fa879 42
532f0516 431;
df1fa879 44
45__END__
46
47=head1 NAME
48
49Catalyst::Engine::Loader - The Catalyst Engine Loader
50
51=head1 SYNOPSIS
52
53See L<Catalyst>.
54
55=head1 DESCRIPTION
56
57Wrapper on L<Plack::Loader> which resets the ::Engine if you are using some
58version of mod_perl.
59
60=head1 AUTHORS
61
62Catalyst Contributors, see Catalyst.pm
63
64=head1 COPYRIGHT
65
66This library is free software. You can redistribute it and/or modify it under
67the same terms as Perl itself.
68
69=cut