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

sartak at bestpractical.com sartak at bestpractical.com
Wed Dec 10 22:30:42 EST 2008


Author: sartak
Date: Wed Dec 10 22:30:42 2008
New Revision: 17168

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

Log:
 r76981 at onn:  sartak | 2008-12-10 22:30:20 -0500
 Prefix matching for Eq rules


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Eq.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Eq.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule/Eq.pm	Wed Dec 10 22:30:42 2008
@@ -13,7 +13,12 @@
     my $self = shift;
     my $path = shift;
 
-    return $path->path eq $self->string;
+    return $path->path eq $self->string unless $self->prefix;
+
+    my $truncated = substr($path->path, 0, length($self->string));
+    return 0 unless $truncated eq $self->string;
+
+    return (1, substr($path->path, length($self->string)));
 }
 
 sub readable_attributes { q{"} . shift->string . q{"} }



More information about the Bps-public-commit mailing list