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

sartak at bestpractical.com sartak at bestpractical.com
Mon Aug 25 16:15:02 EDT 2008


Author: sartak
Date: Mon Aug 25 16:14:50 2008
New Revision: 15446

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

Log:
 r70302 at onn:  sartak | 2008-08-25 15:58:49 -0400
 Add the concept of a "cleanup" stage, a stage that still runs after a dispatch abruptly ends in a stage


Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher.pm	Mon Aug 25 16:14:50 2008
@@ -37,18 +37,12 @@
 sub default_stages {
     my $self = shift;
     my $stage_class = $self->stage_class;
-    my @stages;
 
-    for my $qualifier (qw/before on after/) {
-        my $is_qualified = $qualifier ne 'on';
-        my $stage = $stage_class->new(
-            name => 'on',
-            ($is_qualified ? (qualifier => $qualifier) : ()),
-        );
-        push @stages, $stage;
-    }
+    my $before = $stage_class->new(name => 'on', qualifier => 'before');
+    my $after  = $stage_class->new(name => 'on', qualifier => 'after');
+    my $on     = $stage_class->new(name => 'on', cleanup_stage => $after);
 
-    return \@stages;
+    return [$before, $on, $after];
 }
 
 # ugh, we should probably use IxHash..

Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Stage.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Stage.pm	(original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Stage.pm	Mon Aug 25 16:14:50 2008
@@ -16,6 +16,12 @@
     predicate => 'is_qualified',
 );
 
+has cleanup_stage => (
+    is        => 'ro',
+    isa       => 'Path::Dispatcher::Stage',
+    predicate => 'has_cleanup_stage',
+);
+
 has _rules => (
     metaclass => 'Collection::Array',
     is        => 'rw',



More information about the Bps-public-commit mailing list