[Bps-public-commit] r16621 - in Path-Dispatcher/trunk: lib/Path/Dispatcher/Rule

sartak at bestpractical.com sartak at bestpractical.com
Wed Oct 29 21:43:21 EDT 2008


Author: sartak
Date: Wed Oct 29 21:43:21 2008
New Revision: 16621

Modified:
   Path-Dispatcher/trunk/   (props changed)
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Tokens.pm

Log:
 r74856 at onn:  sartak | 2008-10-29 21:43:18 -0400
 Add support for case insensitive matching in tokens rules


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Tokens.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Tokens.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Tokens.pm	Wed Oct 29 21:43:21 2008
@@ -41,6 +41,12 @@
     default => ' ',
 );
 
+has case_sensitive => (
+    is      => 'rw',
+    isa     => 'Bool',
+    default => 1,
+);
+
 sub _match {
     my $self = shift;
     my $path = shift;
@@ -72,6 +78,7 @@
         }
     }
     elsif ($Str->check($expected)) {
+        ($got, $expected) = (lc $got, lc $expected) if !$self->case_sensitive;
         return $got eq $expected;
     }
     elsif ($RegexpRef->check($expected)) {
@@ -147,5 +154,10 @@
 The default is a space, but if you're matching URLs you probably want to change
 this to a slash.
 
+=head2 case_sensitive
+
+Decide whether the rule matching is case sensitive. Default is 1, case
+sensitive matching.
+
 =cut
 



More information about the Bps-public-commit mailing list