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

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


Author: sartak
Date: Wed Nov 19 13:36:50 2008
New Revision: 16930

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

Log:
 r75821 at onn:  sartak | 2008-11-19 13:36:48 -0500
 Trace running codeblocks


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm	Wed Nov 19 13:36:50 2008
@@ -32,6 +32,9 @@
         eval {
             local $SIG{__DIE__} = 'DEFAULT';
 
+            $match->rule->trace(running => 1, match => $match)
+                if $ENV{PATH_DISPATCHER_TRACE};
+
             push @results, scalar $match->run(@args);
 
             die "Path::Dispatcher abort\n"

Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Rule.pm	Wed Nov 19 13:36:50 2008
@@ -72,10 +72,15 @@
 sub trace {
     my $self = shift;
     my %args = @_;
+    my $match = $args{match};
+
     my $trace = "$self";
     $trace .= " (" . $self->name . ")" if $self->has_name;
 
-    if (my $match = $args{match}) {
+    if ($args{running}) {
+        $trace .= " running codeblock with path (" . $match->path->path . ")";
+    }
+    elsif ($match) {
         $trace .= " matched against (" . $match->path->path . ")";
         $trace .= " with (" . $match->leftover . ") left over"
             if length($match->leftover);



More information about the Bps-public-commit mailing list