[Bps-public-commit] r15455 - in Path-Dispatcher/trunk: lib/Path/Dispatcher/Dispatch

sartak at bestpractical.com sartak at bestpractical.com
Mon Aug 25 19:53:16 EDT 2008


Author: sartak
Date: Mon Aug 25 19:53:16 2008
New Revision: 15455

Modified:
   Path-Dispatcher/trunk/   (props changed)
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch/Match.pm

Log:
 r70340 at onn:  sartak | 2008-08-25 19:53:13 -0400
 Oh. Dynamic scope.


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch/Match.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch/Match.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch/Match.pm	Mon Aug 25 19:53:16 2008
@@ -56,14 +56,10 @@
     # we need to check length because Perl's annoying gotcha of the empty regex
     # actually being an alias for whatever the previously used regex was 
     # (useful last decade when qr// hadn't been invented)
-    if (length($str)) {
-        $str =~ $re
-            or die "Unable to match '$str' against a copy of itself!";
-    }
-    else {
-        # need to clear $1 and friends
-        "x" =~ /^x$/;
-    }
+    # we need to do the match anyway, because we have to clear the number vars
+    ($str, $re) = ("x", "x") if length($str) == 0;
+    $str =~ $re
+        or die "Unable to match '$str' against a copy of itself!";
 
     $code->();
 }



More information about the Bps-public-commit mailing list