X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FCGI%2FMaypole.pm;h=6448480c16241561846d83feedcd720d265f2afd;hb=dd425b2cb6384f804cc1eea9e45660ed6baeb2f1;hp=d223c768c335b20e85d10af609fd0c271498c339;hpb=32ecafee815b0fd8043c0acc2c785f5748fc20ff;p=maypole.git diff --git a/lib/CGI/Maypole.pm b/lib/CGI/Maypole.pm index d223c76..6448480 100644 --- a/lib/CGI/Maypole.pm +++ b/lib/CGI/Maypole.pm @@ -7,7 +7,7 @@ use CGI::Simple; use Maypole::Headers; use Maypole::Constants; -our $VERSION = '2.11'; +our $VERSION = '2.13'; __PACKAGE__->mk_accessors( qw/cgi/ ); @@ -54,10 +54,19 @@ Call this from your CGI script to start the Maypole application. =cut -sub run -{ - my $self = shift; - return $self->handler; +sub run { + my $self = shift; + my $status = $self->handler; + if ($status != OK) { + print <Maypole application error +

Maypole application error

+EOT + } + return $status; } =head1 Implementation @@ -71,9 +80,11 @@ functionality. See L for these: =cut -sub get_request -{ - shift->cgi( CGI::Simple->new ); +sub get_request { + my $self = shift; + my $request_options = $self->config->request_options || {}; + $CGI::Simple::POST_MAX = $request_options->{POST_MAX} if ($request_options->{POST_MAX}); + $self->cgi( CGI::Simple->new ); } =item parse_location @@ -92,12 +103,18 @@ sub parse_location $r->headers_in->set($field_name => $cgi->http($http_header)); } + $r->preprocess_location(); + my $path = $cgi->url( -absolute => 1, -path_info => 1 ); my $loc = $cgi->url( -absolute => 1 ); { no warnings 'uninitialized'; $path .= '/' if $path eq $loc; - $path =~ s/^($loc)?\///; + if ($loc =~ /\/$/) { + $path =~ s/^($loc)?//; + } else { + $path =~ s/^($loc)?\///; + } } $r->path($path); @@ -105,6 +122,10 @@ sub parse_location $r->parse_args; } +=item warn + +=cut + sub warn { my ($self,@args) = @_; my ($package, $line) = (caller)[0,2];