Subject: | whitespace between brackets and quotes for Regex and Path actions not working |
If i have a Regex or Path action that has whitespace between the brackets and quotes, then the action is leaving the quotes as part of the path or regex.
Example:
sub foo : Regex( '^bar$' ) { } # results in '^bar'
sub foo : Regex('^bar$') { } # results in ^bar$
Attached is a possible patch.
--- Dispatcher_o.pm Wed Jul 13 11:30:09 2005
+++ Dispatcher.pm Tue Jul 19 10:20:34 2005
@@ -320,15 +320,15 @@
if ( $flags{path} ) {
$flags{path} =~ s/^\w+//;
$flags{path} =~ s/\w+$//;
- if ( $flags{path} =~ /^'(.*)'$/ ) { $flags{path} = $1 }
- if ( $flags{path} =~ /^"(.*)"$/ ) { $flags{path} = $1 }
+ if ( $flags{path} =~ /^\s*'(.*)'\s*$/ ) { $flags{path} = $1 }
+ if ( $flags{path} =~ /^\s*"(.*)"\s*$/ ) { $flags{path} = $1 }
}
if ( $flags{regex} ) {
$flags{regex} =~ s/^\w+//;
$flags{regex} =~ s/\w+$//;
- if ( $flags{regex} =~ /^'(.*)'$/ ) { $flags{regex} = $1 }
- if ( $flags{regex} =~ /^"(.*)"$/ ) { $flags{regex} = $1 }
+ if ( $flags{regex} =~ /^\s*'(.*)'\s*$/ ) { $flags{regex} = $1 }
+ if ( $flags{regex} =~ /^\s*"(.*)"\s*$/ ) { $flags{regex} = $1 }
}
my $reverse = $prefix ? "$prefix/$method" : $method;