| 1 | package FCGI::Engine; | ||||||||||
| 2 | 9 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | |||||||||||
| 4 | 9 | ▶ | use Class::Load (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 9 | ▶ | use CGI::Simple; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 9 | our $VERSION = '0.22'; | |||||||||
| 8 | 9 | our $AUTHORITY = 'cpan:STEVAN'; | |||||||||
| 9 | |||||||||||
| 10 | 9 | extends 'FCGI::Engine::Core'; | |||||||||
| 11 | |||||||||||
| 12 | 9 | has 'handler_class' => ( | |||||||||
| 13 | metaclass => 'NoGetopt', | ||||||||||
| 14 | is => 'ro', | ||||||||||
| 15 | isa => 'Str | Object', | ||||||||||
| 16 | required => 1, | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | has 'handler_method' => ( | ||||||||||
| 20 | metaclass => 'NoGetopt', | ||||||||||
| 21 | is => 'ro', | ||||||||||
| 22 | isa => 'Str', | ||||||||||
| 23 | 10 | ▶ | default => sub { 'handler' }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 9 | ); | |||||||||
| 25 | |||||||||||
| 26 | has 'handler_args_builder' => ( | ||||||||||
| 27 | metaclass => 'NoGetopt', | ||||||||||
| 28 | is => 'ro', | ||||||||||
| 29 | isa => 'CodeRef', | ||||||||||
| 30 | 10 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 31 | 3 | ▶ | sub { CGI::Simple->new } | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 32 | 10 | }, | |||||||||
| 33 | 9 | ); | |||||||||
| 34 | |||||||||||
| 35 | 7 | ▶ | augment 'initialize' => sub { | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.2
| |||||||||||
| 36 | 7 | my ( $self, %addtional_options ) = @_; | |||||||||
| 37 | |||||||||||
| 38 | 7 | my $handler_class = $self->handler_class; | |||||||||
| 39 | 7 | my $handler_method = $self->handler_method; | |||||||||
| 40 | 7 | my $handler_args = $self->handler_args_builder; | |||||||||
| 41 | |||||||||||
| 42 | 7 | ▶ | Class::Load::load_class($handler_class) unless blessed $handler_class; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | |||||||||||
| 44 | 7 | ▶ | ($self->handler_class->can($handler_method)) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | || confess "The handler class (" | ||||||||||
| 46 | . $handler_class | ||||||||||
| 47 | . ") does not support the handler method (" | ||||||||||
| 48 | . $handler_method | ||||||||||
| 49 | . ")"; | ||||||||||
| 50 | 9 | }; | |||||||||
| 51 | |||||||||||
| 52 | 7 | ▶ | sub create_environment { \%ENV } | ||||||||
|
Subroutine
create_environment: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 53 | |||||||||||
| 54 | 3 | ▶ | sub handle_request { | ||||||||
|
Subroutine
handle_request: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 55 | 3 | my $self = shift; | |||||||||
| 56 | 3 | my $method = $self->handler_method; | |||||||||
| 57 | 3 | $self->handler_class->$method( $self->handler_args_builder->() ); | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 9 | 1; | |||||||||
| 61 | |||||||||||
| 62 | __END__ | ||||||||||