51aecbfe3d8d0fff31f0990f71e5ccfc618ab764
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / CGI / NPH.pm
1 package Catalyst::Engine::CGI::NPH;
2
3 use strict;
4 use base 'Catalyst::Engine::CGI';
5
6 use HTTP::Status ();
7
8 =head1 NAME
9
10 Catalyst::Engine::CGI::NPH - Catalyst CGI Engine
11
12 =head1 SYNOPSIS
13
14 See L<Catalyst>.
15
16 =head1 DESCRIPTION
17
18 This Catalyst engine returns a complete HTTP response message.
19
20 =head1 OVERLOADED METHODS
21
22 This class overloads some methods from C<Catalyst::Engine::CGI>.
23
24 =over 4
25
26 =item $c->finalize_headers
27
28 =cut
29
30 sub finalize_headers {
31     my $c = shift;
32
33     my $protocol = $ENV{SERVER_PROTOCOL} || 'HTTP/1.0';
34     my $status   = $c->response->status || 200;
35     my $message  =  HTTP::Status::status_message($status);
36    
37     printf( "%s %d %s\015\012", $protocol, $status, $message );
38
39     $c->SUPER::finalize_headers;
40 }
41
42 =back
43
44 =head1 SEE ALSO
45
46 L<Catalyst>, L<Catalyst::Engine::CGI>.
47
48 =head1 AUTHOR
49
50 Sebastian Riedel, C<sri@cpan.org>
51 Christian Hansen, C<ch@ngmedia.com>
52
53 =head1 COPYRIGHT
54
55 This program is free software, you can redistribute it and/or modify it under
56 the same terms as Perl itself.
57
58 =cut
59
60 1;