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

sartak at bestpractical.com sartak at bestpractical.com
Wed Nov 19 13:23:13 EST 2008


Author: sartak
Date: Wed Nov 19 13:23:13 2008
New Revision: 16929

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

Log:
 r75817 at onn:  sartak | 2008-11-19 13:23:10 -0500
 Declarative dispatcher sets rule name


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Declarative.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Declarative.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Declarative.pm	Wed Nov 19 13:23:13 2008
@@ -191,15 +191,22 @@
         $rule = shift;
     }
 
+    # XXX: caller level should be closer to $Test::Builder::Level
+    my (undef, $file, $line) = caller(1);
+    my $rule_name = "$file:$line";
+
     if (!defined(wantarray)) {
         if ($UNDER_RULE) {
             $UNDER_RULE->add_rule($rule);
+            $rule->name($UNDER_RULE->name . " (rule $rule_name)");
         }
         else {
             $self->dispatcher->add_rule($rule);
+            $rule->name($self->dispatcher->name . " (rule $rule_name)");
         }
     }
     else {
+        $rule->name($rule_name);
         return $rule, @_;
     }
 }



More information about the Bps-public-commit mailing list