Commit | Line | Data |
d1d9793f |
1 | package Catalyst::Engine::FastCGI; |
ffb41d94 |
2 | |
3 | use strict; |
fbcc39ad |
4 | use base 'Catalyst::Engine::CGI'; |
5 | use FCGI; |
ffb41d94 |
6 | |
7 | =head1 NAME |
8 | |
fbcc39ad |
9 | Catalyst::Engine::FastCGI - FastCGI Engine |
ffb41d94 |
10 | |
11 | =head1 DESCRIPTION |
12 | |
fbcc39ad |
13 | This is the FastCGI engine. |
ffb41d94 |
14 | |
e2fd5b5f |
15 | =head1 OVERLOADED METHODS |
16 | |
fbcc39ad |
17 | This class overloads some methods from C<Catalyst::Engine::CGI>. |
e2fd5b5f |
18 | |
19 | =over 4 |
20 | |
fbcc39ad |
21 | =item $self->run($c) |
e2fd5b5f |
22 | |
23 | =cut |
24 | |
fbcc39ad |
25 | sub run { |
26 | my ( $self, $class ) = @_; |
e2fd5b5f |
27 | |
fbcc39ad |
28 | my $request = FCGI::Request(); |
e2fd5b5f |
29 | |
fbcc39ad |
30 | while ( $request->Accept >= 0 ) { |
31 | $class->handle_request; |
32 | } |
e2fd5b5f |
33 | } |
34 | |
fbcc39ad |
35 | =item $self->write($c, $buffer) |
e2fd5b5f |
36 | |
37 | =cut |
38 | |
fbcc39ad |
39 | sub write { |
40 | my ( $self, $c, $buffer ) = @_; |
4f5ebacd |
41 | |
fbcc39ad |
42 | unless ( $self->{_prepared_write} ) { |
4f5ebacd |
43 | $self->prepare_write($c); |
fbcc39ad |
44 | $self->{_prepared_write} = 1; |
45 | } |
4f5ebacd |
46 | |
fbcc39ad |
47 | # FastCGI does not stream data properly if using 'print $handle', |
48 | # but a syswrite appears to work properly. |
4f5ebacd |
49 | *STDOUT->syswrite($buffer); |
e2fd5b5f |
50 | } |
51 | |
fbcc39ad |
52 | =back |
e2fd5b5f |
53 | |
fbcc39ad |
54 | =head1 SEE ALSO |
e2fd5b5f |
55 | |
fbcc39ad |
56 | L<Catalyst>, L<FCGI>. |
cd3bb248 |
57 | |
fbcc39ad |
58 | =head1 AUTHORS |
ffb41d94 |
59 | |
fbcc39ad |
60 | Sebastian Riedel, <sri@cpan.org> |
ffb41d94 |
61 | |
fbcc39ad |
62 | Christian Hansen, <ch@ngmedia.com> |
ffb41d94 |
63 | |
fbcc39ad |
64 | Andy Grundman, <andy@hybridized.org> |
ffb41d94 |
65 | |
66 | =head1 COPYRIGHT |
67 | |
68 | This program is free software, you can redistribute it and/or modify it under |
69 | the same terms as Perl itself. |
70 | |
71 | =cut |
72 | |
73 | 1; |