3 SGN::Controller::CGI - run SGN CGI scripts
7 package SGN
::Controller
::CGI
;
10 use namespace
::autoclean
;
12 BEGIN{ extends
'Catalyst::Controller::CGIBin'; }
27 cgi_file_pattern
=> '*.pl',
34 my %skip = map { $_ => 1 } qw(
35 another_page_that_doesnt_compile.pl
36 page_with_syntax_error.pl
39 # all our .pl cgis are perl, just match the filenames, which speeds up
40 # startup considerably.
42 my ($self,$path) = @_;
43 return 0 if $skip{ basename
($path) };
44 return $path =~ /\.pl$/;
47 if( $ENV{SGN_SKIP_CGI
} ) {
48 override
'cgi_dir' => sub { File
::Spec
->devnull },
51 # force CGI backtrace only if app is starting, and is in debug mode
52 if( eval{ SGN
->debug } ) {
53 around
'wrap_cgi' => sub {
61 s/\sCatalyst::Controller::CGIBin.+//s;
70 # remove the content-length for CGI responses after running them, let
71 # catalyst recalculate it later in the response cycle. this works
72 # around a bug somewhere in HTTP::Request::AsCGI
73 after
'cgi_to_response' => sub {
74 my ( $self, $c ) = @_;
75 $c->res->headers->remove_header('content-length');
79 my ( $self, $path ) = @_;
81 my $action_name = $self->cgi_action($path)
84 return $self->action_for( $action_name )