X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole%2FCLI.pm;h=de8fab65118cfe04c3f51b2cb7e9831a2f2af362;hb=346143529922475f513453053cab4b387ac22b9d;hp=81a2fd5083b2e2d4d10908895ae1ad7fa8af04fa;hpb=7dda5e1451220612c6ad749746d84e4c090e330c;p=maypole.git diff --git a/lib/Maypole/CLI.pm b/lib/Maypole/CLI.pm index 81a2fd5..de8fab6 100644 --- a/lib/Maypole/CLI.pm +++ b/lib/Maypole/CLI.pm @@ -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; }