X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FCGI.pm;h=e682f6e818a1db2e961c17edd98c490d163ba434;hb=9a33da6aa4eb69de77c36f572e875a2529a39eef;hp=c6d387a9e5a5c9e5f1b12d6789faede4c9719665;hpb=fc7ec1d96ee55d1bf42af3abce155ecb717b9e2b;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/CGI.pm b/lib/Catalyst/Engine/CGI.pm index c6d387a..e682f6e 100644 --- a/lib/Catalyst/Engine/CGI.pm +++ b/lib/Catalyst/Engine/CGI.pm @@ -7,6 +7,9 @@ use URI; require CGI::Simple; require CGI::Cookie; +$CGI::Simple::POST_MAX = 1048576; +$CGI::Simple::DISABLE_UPLOADS = 0; + __PACKAGE__->mk_accessors('cgi'); =head1 NAME @@ -15,12 +18,27 @@ Catalyst::Engine::CGI - The CGI Engine =head1 SYNOPSIS + #!/usr/bin/perl -w + + use strict; + use lib '/path/to/MyApp/lib'; + use MyApp; + + MyApp->run; + See L. =head1 DESCRIPTION This is the CGI engine for Catalyst. +The script shown above must be designated as a "Non-parsed Headers" +script to function properly. +To do this in Apache name the script starting with C. + +The performance of this way of using Catalyst is not expected to be +useful in production applications, but it may be helpful for development. + =head2 METHODS =head3 run @@ -115,6 +133,10 @@ sub prepare_path { $c->req->{path} =~ s/^($loc)?\///; $c->req->{path} .= '/' if $c->req->path eq $loc; my $base = $c->cgi->url; + if ( $ENV{CATALYST_TEST} ) { + my $script = $c->cgi->script_name; + $base =~ s/$script$//i; + } $base = URI->new($base); $base->path('/') if ( $ENV{CATALYST_TEST} || !$base->path ); $c->req->base( $base->as_string ); @@ -133,12 +155,10 @@ sub prepare_request { shift->cgi( CGI::Simple->new ) } sub prepare_uploads { my $c = shift; for my $name ( $c->cgi->upload ) { - my $filename = $c->req->params->{$name}; $c->req->uploads->{$name} = { - fh => $c->cgi->upload($filename), - filename => $filename, - size => $c->cgi->upload_info( $filename, 'size' ), - type => $c->cgi->upload_info( $filename, 'mime' ) + fh => $c->cgi->upload($name), + size => $c->cgi->upload_info( $name, 'size' ), + type => $c->cgi->upload_info( $name, 'mime' ) }; } } @@ -161,4 +181,3 @@ the same terms as Perl itself. =cut 1; -## Please see file perltidy.ERR