Merged 5.49_01 (r1339) from refactored branch to trunk
[catagits/Catalyst-Runtime.git] / lib / Catalyst / Engine / FastCGI.pm
CommitLineData
d1d9793f 1package Catalyst::Engine::FastCGI;
ffb41d94 2
3use strict;
fbcc39ad 4use base 'Catalyst::Engine::CGI';
5use FCGI;
ffb41d94 6
7=head1 NAME
8
fbcc39ad 9Catalyst::Engine::FastCGI - FastCGI Engine
ffb41d94 10
11=head1 DESCRIPTION
12
fbcc39ad 13This is the FastCGI engine.
ffb41d94 14
e2fd5b5f 15=head1 OVERLOADED METHODS
16
fbcc39ad 17This 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 25sub 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 39sub write {
40 my ( $self, $c, $buffer ) = @_;
41
42 unless ( $self->{_prepared_write} ) {
43 $self->prepare_write( $c );
44 $self->{_prepared_write} = 1;
45 }
46
47 # FastCGI does not stream data properly if using 'print $handle',
48 # but a syswrite appears to work properly.
49 $c->response->handle->syswrite( $buffer );
e2fd5b5f 50}
51
fbcc39ad 52=back
e2fd5b5f 53
fbcc39ad 54=head1 SEE ALSO
e2fd5b5f 55
fbcc39ad 56L<Catalyst>, L<FCGI>.
cd3bb248 57
fbcc39ad 58=head1 AUTHORS
ffb41d94 59
fbcc39ad 60Sebastian Riedel, <sri@cpan.org>
ffb41d94 61
fbcc39ad 62Christian Hansen, <ch@ngmedia.com>
ffb41d94 63
fbcc39ad 64Andy Grundman, <andy@hybridized.org>
ffb41d94 65
66=head1 COPYRIGHT
67
68This program is free software, you can redistribute it and/or modify it under
69the same terms as Perl itself.
70
71=cut
72
731;