Added recursive -r flag to prove example
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / Apache / MP20 / Base.pm
CommitLineData
316bf0f0 1package Catalyst::Engine::Apache::MP20::Base;
2
3use strict;
4use base 'Catalyst::Engine::Apache::Base';
5
6use Apache2::Connection ();
7use Apache2::Const ();
8use Apache2::RequestIO ();
9use Apache2::RequestRec ();
10use Apache2::RequestUtil ();
566ee5d7 11use Apache2::Response ();
316bf0f0 12
13Apache2::Const->import( -compile => ':common' );
14
15=head1 NAME
16
17Catalyst::Engine::Apache::MP20::Base - Base class for MP 2.0 Engines
18
19=head1 SYNOPSIS
20
21See L<Catalyst>.
22
23=head1 DESCRIPTION
24
25This is a base class for MP 2.0 Engines.
26
27=head1 OVERLOADED METHODS
28
29This class overloads some methods from C<Catalyst::Engine::Apache::Base>.
30
31=over 4
32
33=item $c->finalize_headers
34
35=cut
36
37sub finalize_headers {
38 my $c = shift;
39
40 for my $name ( $c->response->headers->header_field_names ) {
566ee5d7 41 next if $name =~ /^Content-(Length|Type)$/i;
316bf0f0 42 my @values = $c->response->header($name);
43 $c->apache->headers_out->add( $name => $_ ) for @values;
44 }
45
46 if ( $c->response->header('Set-Cookie') && $c->response->status >= 300 ) {
47 my @values = $c->response->header('Set-Cookie');
48 $c->apache->err_headers_out->add( 'Set-Cookie' => $_ ) for @values;
49 }
50
51 $c->apache->status( $c->response->status );
566ee5d7 52
53 if ( my $type = $c->response->header('Content-Type') ) {
54 $c->apache->content_type($type);
55 }
56
57 if ( my $length = $c->response->content_length ) {
58 $c->apache->set_content_length($length);
59 }
316bf0f0 60
61 return 0;
62}
63
64=item $c->handler
65
66=cut
67
68sub handler : method {
69 shift->SUPER::handler(@_);
70}
71
72=back
73
74=head1 SEE ALSO
75
76L<Catalyst>, L<Catalyst::Engine>, L<Catalyst::Engine::Apache::Base>.
77
78=head1 AUTHOR
79
80Sebastian Riedel, C<sri@cpan.org>
81Christian Hansen C<ch@ngmedia.com>
82
83=head1 COPYRIGHT
84
85This program is free software, you can redistribute it and/or modify it under
86the same terms as Perl itself.
87
88=cut
89
901;