[Jifty-commit] r877 - jifty/trunk/lib/Jifty

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Thu Apr 20 03:27:27 EDT 2006


Author: autrijus
Date: Thu Apr 20 03:27:26 2006
New Revision: 877

Modified:
   jifty/trunk/lib/Jifty/Dispatcher.pm

Log:
* Jifty::Dispatcher - Make it Really Work (tm) :)

Modified: jifty/trunk/lib/Jifty/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Dispatcher.pm	Thu Apr 20 03:27:26 2006
@@ -862,6 +862,11 @@
     $cond =~ s{(?:\\\/)+}{/}g;
     $cond =~ s{/$}{};
 
+    my $has_capture = ( $cond =~ / \\ [*?] /x);
+    if ($has_capture) {
+        $cond = $self->_compile_glob($cond);
+    }
+
     if ( $cond =~ m{^/} ) {
 
         # '/foo' => qr{^/foo}
@@ -875,6 +880,7 @@
         # empty path -- just match $cwd itself
         $cond = "(?<=\\A$self->{cwd})";
     }
+
     if ( $Dispatcher->{rule} eq 'on' ) {
 
         # "on" anchors on complete match only
@@ -886,10 +892,7 @@
     }
 
     # Make all metachars into capturing submatches
-    if ( $cond =~ / \\ [*?] /x) {
-        $cond = _compile_glob($cond);
-    }
-    else {
+    if (!$has_capture) {
         $cond = "($cond)";
     }
 
@@ -940,9 +943,9 @@
     $glob =~ s{
         # Stars between two slashes, or between a slash and end-of-string,
         # should at match one or more non-slash characters.
-        (?<= \\ /)      # lookbehind for slash
-        \\ \*           # star
-        (?= \\ / | \z)  # lookahead for slash or end-of-string
+        (?<= /)      # lookbehind for slash
+        \\ \*        # star
+        (?= / | \z)  # lookahead for slash or end-of-string
     }{([^/]+)}gx;
     $glob =~ s{
         # All other stars can match zero or more non-slash character.


More information about the Jifty-commit mailing list