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

sartak at bestpractical.com sartak at bestpractical.com
Mon Aug 25 21:19:48 EDT 2008


Author: sartak
Date: Mon Aug 25 21:19:42 2008
New Revision: 15459

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

Log:
 r70342 at onn:  sartak | 2008-08-25 21:11:54 -0400
 Invoke the "outermost" dispatcher when using declarative's dispatch/run


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	Mon Aug 25 21:19:42 2008
@@ -6,6 +6,7 @@
 use Path::Dispatcher;
 
 our $CALLER; # Sub::Exporter doesn't make this available
+our $OUTERMOST_DISPATCHER;
 
 my $exporter = Sub::Exporter::build_exporter({
     into_level => 1,
@@ -51,11 +52,18 @@
         dispatcher => sub { $dispatcher },
         dispatch   => sub {
             shift; # don't need $self
-            $dispatcher->dispatch(@_);
+            local $OUTERMOST_DISPATCHER = $dispatcher
+                if !$OUTERMOST_DISPATCHER;
+
+            $OUTERMOST_DISPATCHER->dispatch(@_);
         },
         run => sub {
             shift; # don't need $self
-            $dispatcher->run(@_);
+
+            local $OUTERMOST_DISPATCHER = $dispatcher
+                if !$OUTERMOST_DISPATCHER;
+
+            $OUTERMOST_DISPATCHER->run(@_);
         },
         on => sub {
             $dispatcher->stage('on')->add_rule(



More information about the Bps-public-commit mailing list