Updated changes file
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / Apache / MP13.pm
CommitLineData
111728e3 1package Catalyst::Engine::Apache::MP13;
479d2af4 2
3use strict;
c2e8e6fa 4use base 'Catalyst::Engine::Apache::Base';
479d2af4 5
e7c0c583 6use Apache ();
7use Apache::Constants ();
8use Apache::Request ();
479d2af4 9
e7c0c583 10Apache::Constants->import(':common');
479d2af4 11
12=head1 NAME
13
329a7e51 14Catalyst::Engine::Apache::MP13 - Catalyst Apache MP13 Engine
479d2af4 15
16=head1 SYNOPSIS
17
18See L<Catalyst>.
19
20=head1 DESCRIPTION
21
06e1b616 22This is the Catalyst engine specialized for Apache mod_perl version 1.3x.
479d2af4 23
24=head1 OVERLOADED METHODS
25
c2e8e6fa 26This class overloads some methods from C<Catalyst::Engine::Apache::Base>.
479d2af4 27
28=over 4
29
e7c0c583 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 ) {
38 next if $name =~ /Content-Type/i;
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 );
49 $c->apache->content_type( $c->response->header('Content-Type') );
50
51 $c->apache->send_http_header;
52
53 return 0;
54}
55
479d2af4 56=item $c->handler
57
e7c0c583 58=cut
59
60sub handler ($$) {
61 shift->SUPER::handler(@_);
62}
63
329a7e51 64=item $c->prepare_request($r)
65
66=cut
67
68sub prepare_request {
69 my ( $c, $r ) = @_;
70 $c->apache( Apache::Request->new($r) );
71}
72
e7c0c583 73=item $c->prepare_uploads
74
75=cut
76
77sub prepare_uploads {
78 my $c = shift;
79
80 my @uploads;
81
82 for my $upload ( $c->apache->upload ) {
83
146554c5 84 my $object = Catalyst::Request::Upload->new(
e7c0c583 85 filename => $upload->filename,
86 size => $upload->size,
87 tempname => $upload->tempname,
88 type => $upload->type
146554c5 89 );
e7c0c583 90
146554c5 91 push( @uploads, $upload->name, $object );
e7c0c583 92 }
93
bfde09a2 94 $c->request->upload(@uploads);
e7c0c583 95}
96
479d2af4 97=back
98
99=head1 SEE ALSO
100
c2e8e6fa 101L<Catalyst>, L<Catalyst::Engine>, L<Catalyst::Engine::Apache::Base>.
479d2af4 102
103=head1 AUTHOR
104
105Sebastian Riedel, C<sri@cpan.org>
329a7e51 106Christian Hansen C<ch@ngmedia.com>
479d2af4 107
108=head1 COPYRIGHT
109
110This program is free software, you can redistribute it and/or modify it under
111the same terms as Perl itself.
112
113=cut
114
1151;