Commit | Line | Data |
e646f111 |
1 | package Catalyst::Engine::CGI::NPH; |
2 | |
3 | use strict; |
4 | use base 'Catalyst::Engine::CGI'; |
5 | |
c038f8ff |
6 | use HTTP::Status (); |
7 | |
e646f111 |
8 | =head1 NAME |
9 | |
10 | Catalyst::Engine::CGI::NPH - Catalyst CGI Engine |
11 | |
12 | =head1 SYNOPSIS |
13 | |
c9afa5fc |
14 | A script using the Catalyst::Engine::CGI::NPH module might look like: |
15 | |
16 | #!/usr/bin/perl -w |
17 | |
18 | BEGIN { |
19 | $ENV{CATALYST_ENGINE} = 'CGI::NPH'; |
20 | } |
21 | |
22 | use strict; |
23 | use lib '/path/to/MyApp/lib'; |
24 | use MyApp; |
25 | |
26 | MyApp->run; |
e646f111 |
27 | |
28 | =head1 DESCRIPTION |
29 | |
30 | This Catalyst engine returns a complete HTTP response message. |
31 | |
32 | =head1 OVERLOADED METHODS |
33 | |
34 | This class overloads some methods from C<Catalyst::Engine::CGI>. |
35 | |
36 | =over 4 |
37 | |
38 | =item $c->finalize_headers |
39 | |
40 | =cut |
41 | |
42 | sub finalize_headers { |
43 | my $c = shift; |
c038f8ff |
44 | |
cfc303c8 |
45 | my $protocol = $ENV{SERVER_PROTOCOL} || 'HTTP/1.0'; |
46 | my $status = $c->response->status || 200; |
47 | my $message = HTTP::Status::status_message($status); |
48 | |
49 | printf( "%s %d %s\015\012", $protocol, $status, $message ); |
50 | |
c038f8ff |
51 | $c->SUPER::finalize_headers; |
e646f111 |
52 | } |
53 | |
54 | =back |
55 | |
56 | =head1 SEE ALSO |
57 | |
58 | L<Catalyst>, L<Catalyst::Engine::CGI>. |
59 | |
60 | =head1 AUTHOR |
61 | |
62 | Sebastian Riedel, C<sri@cpan.org> |
63 | Christian Hansen, C<ch@ngmedia.com> |
64 | |
65 | =head1 COPYRIGHT |
66 | |
67 | This program is free software, you can redistribute it and/or modify it under |
68 | the same terms as Perl itself. |
69 | |
70 | =cut |
71 | |
72 | 1; |