File Coverage

blib/lib/CatalystX/Script/FCGI/Engine.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package CatalystX::Script::FCGI::Engine;
2 1     1   1852 use Moose;
  0            
  0            
3             use FCGI::Engine;
4             use namespace::autoclean;
5              
6             our $VERSION = '0.003';
7              
8             extends 'Catalyst::Script::FastCGI';
9              
10             has '+manager' => (
11             default => 'FCGI::Engine::ProcManager',
12             );
13              
14             sub _run_application {
15             my $self = shift;
16             my ($listen, $args) = $self->_application_args;
17             Class::MOP::load_class($self->application_name);
18             my @detach = delete($args->{detach}) ? ( detach => 1 ) : ();
19             my @listen = $listen ? (listen => $listen, use_manager => 1) : ();
20             $args->{nproc} ||= 5;
21             delete($args->{pidfile}) unless $args->{pidfile};
22             FCGI::Engine->new(
23             handler_class => $self->application_name,
24             handler_method => 'handle_request',
25             pre_fork_init => sub {},
26             handler_args_builder => sub {},
27             @listen,
28             @detach,
29             %$args,
30             )->run;
31             }
32              
33             __PACKAGE__->meta->make_immutable;
34              
35             1;
36              
37             =head1 NAME
38              
39             CatalystX::Script::FCGI::Engine - FCGI::Engine script for Catalyst
40              
41             =head1 SYNOPSIS
42              
43             package MyApp::Script::FastCGI;
44             use Moose;
45            
46             extends 'CatalystX::Script::FCGI::Engine';
47            
48             no Moose;
49             1;
50              
51             =head1 DESCRIPTION
52              
53             Replacement FastCGI script which overrides Catalyst's use of L<FCGI::ProcManager>
54             with L<FCGI::Engine>, and process management with L<FCGI::Engine::ProcManager>.
55              
56             =head1 AUTHOR
57              
58             Tomas Doran (t0m) C<< <bobtfish@bobtfish.net> >>.
59              
60             =head1 COPYRIGHT & LICENSE
61              
62             Copyright 2011 the above author(s).
63              
64             This sofware is free software, and is licensed under the same terms as perl itself.
65              
66             =cut
67