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