added synopsis to Engine subclassed and documented a couple of methods to make podcov...
[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 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;
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;
44
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
51     $c->SUPER::finalize_headers;
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;