b20fea8a237734d3083405c8c1f795fc969f01ca
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / Apache / MP20.pm
1 package Catalyst::Engine::Apache::MP20;
2
3 use strict;
4 use base qw[Catalyst::Engine::Apache::MP20::Base Catalyst::Engine::CGI];
5
6 =head1 NAME
7
8 Catalyst::Engine::Apache::MP20 - Catalyst Apache MP20 Engine
9
10 =head1 SYNOPSIS
11
12 See L<Catalyst>.
13
14 =head1 DESCRIPTION
15
16 This is the Catalyst engine specialized for Apache mod_perl version 2.0.
17
18 =head1 OVERLOADED METHODS
19
20 This class overloads some methods from C<Catalyst::Engine::Apache::MP20::Base>
21 and C<Catalyst::Engine::CGI>.
22
23 =over 4
24
25 =item $c->prepare_body
26
27 =cut
28
29 sub prepare_body {
30     shift->Catalyst::Engine::CGI::prepare_body(@_);
31 }
32
33 =item $c->prepare_parameters
34
35 =cut
36
37 sub prepare_parameters {
38     shift->Catalyst::Engine::CGI::prepare_parameters(@_);
39 }
40
41 =item $c->prepare_request
42
43 =cut
44
45 sub prepare_request {
46     my ( $c, $r, @arguments ) = @_;
47
48     unless ( $ENV{REQUEST_METHOD} ) {
49
50         $ENV{CONTENT_TYPE}   = $r->headers_in->get("Content-Type");
51         $ENV{CONTENT_LENGTH} = $r->headers_in->get("Content-Length");
52         $ENV{QUERY_STRING}   = $r->args;
53         $ENV{REQUEST_METHOD} = $r->method;
54
55         my $cleanup = sub {
56             delete( $ENV{$_} ) for qw( CONTENT_TYPE
57                                        CONTENT_LENGTH
58                                        QUERY_STRING
59                                        REQUEST_METHOD );
60         };
61
62         $r->pool->cleanup_register($cleanup);
63     }
64
65     $c->SUPER::prepare_request($r);
66     $c->Catalyst::Engine::CGI::prepare_request( $r, @arguments );
67 }
68
69 =item $c->prepare_uploads
70
71 =cut
72
73 sub prepare_uploads {
74     shift->Catalyst::Engine::CGI::prepare_uploads(@_);
75 }
76
77 =back
78
79 =head1 SEE ALSO
80
81 L<Catalyst>, L<Catalyst::Engine>, L<Catalyst::Engine::Apache::Base>.
82
83 =head1 AUTHOR
84
85 Sebastian Riedel, C<sri@cpan.org>
86 Christian Hansen C<ch@ngmedia.com>
87
88 =head1 COPYRIGHT
89
90 This program is free software, you can redistribute it and/or modify it under
91 the same terms as Perl itself.
92
93 =cut
94
95 1;