]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/CLI.pm
Added patch for CGI front-end to report fatal errors instead of staying silent and...
[maypole.git] / lib / Maypole / CLI.pm
index 81a2fd5083b2e2d4d10908895ae1ad7fa8af04fa..de8fab65118cfe04c3f51b2cb7e9831a2f2af362 100644 (file)
@@ -29,9 +29,10 @@ sub get_template_root { $ENV{MAYPOLE_TEMPLATES} || "." }
 sub parse_location {
     my $self = shift;
     my $url  = URI->new( shift @ARGV );
-    my $root = URI->new( $self->config->uri_base )->path;
+    (my $uri_base = $self->config->uri_base) =~ s:/$::;
+    my $root = URI->new( $uri_base )->path;
     $self->{path} = $url->path;
-    $self->{path} =~ s/^$root//i if $root;
+    $self->{path} =~ s:^$root/?::i if $root;
     $self->parse_path;
     $self->parse_args($url);
 }
@@ -46,7 +47,7 @@ sub send_output { $buffer = shift->{output} }
 
 sub call_url {
     my $self = shift;
-    @ARGV = @_;
+    local @ARGV = @_;
     $package->handler() == OK and return $buffer;
 }