X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FCLI.pm;h=de8fab65118cfe04c3f51b2cb7e9831a2f2af362;hb=dd369c8a18080c4f27237f23b5842d53da05f570;hp=504d0b428a18596aa373a66d4643f7bbe207814b;hpb=f9a6b47b3b916585d710eac141003fb8261d9c3c;p=maypole.git diff --git a/lib/Maypole/CLI.pm b/lib/Maypole/CLI.pm index 504d0b4..de8fab6 100644 --- a/lib/Maypole/CLI.pm +++ b/lib/Maypole/CLI.pm @@ -29,10 +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} .= '/' if $self->{path} eq $root; - $self->{path} =~ s/^$root//i if $root; + $self->{path} =~ s:^$root/?::i if $root; $self->parse_path; $self->parse_args($url); } @@ -47,7 +47,7 @@ sub send_output { $buffer = shift->{output} } sub call_url { my $self = shift; - @ARGV = @_; + local @ARGV = @_; $package->handler() == OK and return $buffer; }