0ee022b8e4c769ddfba964d3a24cfd7d79ed97b4
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / FCGI.pm
1 package Catalyst::Engine::FCGI;
2
3 use strict;
4 use base 'Catalyst::Engine::CGI';
5 use FCGI;
6 use NEXT;
7
8 =head1 NAME
9
10 Catalyst::Engine::FCGI - Catalyst FCGI Engine
11
12 =head1 SYNOPSIS
13
14 See L<Catalyst>.
15
16 =head1 DESCRIPTION
17
18 This is the Catalyst engine for FastCGI.
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->run
27
28 =cut
29
30 sub run {
31     my $class   = shift;
32     my $request = FCGI::Request();
33     while ( $request->Accept() >= 0 ) {
34         my $output;
35         {
36             local (*STDOUT);
37             open( STDOUT, '>', \$output );
38             $class->NEXT::run;
39         }
40         $output =~ s!^HTTP/\d+.\d+ \d\d\d.*?\n!!s;
41         print $output;
42     }
43 }
44
45 =back
46
47 =head1 SEE ALSO
48
49 L<Catalyst>.
50
51 =head1 AUTHOR
52
53 Sebastian Riedel, C<sri@cpan.org>
54
55 =head1 COPYRIGHT
56
57 This program is free software, you can redistribute it and/or modify it under
58 the same terms as Perl itself.
59
60 =cut
61
62 1;