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);
}
sub call_url {
my $self = shift;
- @ARGV = @_;
+ local @ARGV = @_;
$package->handler() == OK and return $buffer;
}