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

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


Author: sartak
Date: Mon Aug 25 16:13:59 2008
New Revision: 15441

Modified:
   Path-Dispatcher/trunk/   (props changed)
   Path-Dispatcher/trunk/lib/Path/Dispatcher.pm
   Path-Dispatcher/trunk/lib/Path/Dispatcher/Declarative.pm
   Path-Dispatcher/trunk/t/004-stages.t
   Path-Dispatcher/trunk/t/005-multi-rule.t
   Path-Dispatcher/trunk/t/006-abort.t
   Path-Dispatcher/trunk/t/010-return.t

Log:
 r70297 at onn:  sartak | 2008-08-25 15:39:27 -0400
 Remove the first and last stages. If apps want them, they can add them


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:13:59 2008
@@ -39,15 +39,13 @@
     my $stage_class = $self->stage_class;
     my @stages;
 
-    for my $stage_name (qw/first on last/) {
-        for my $qualifier (qw/before on after/) {
-            my $is_qualified = $qualifier ne 'on';
-            my $stage = $stage_class->new(
-                name => $stage_name,
-                ($is_qualified ? (qualifier => $qualifier) : ()),
-            );
-            push @stages, $stage;
-        }
+    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;
     }
 
     return \@stages;

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 16:13:59 2008
@@ -66,7 +66,7 @@
             );
         },
         before => sub {
-            $dispatcher->stage('first')->add_rule(
+            $dispatcher->stage('before_on')->add_rule(
                 Path::Dispatcher::Rule::Regex->new(
                     regex => $_[0],
                     block => $_[1],
@@ -74,7 +74,7 @@
             );
         },
         after => sub {
-            $dispatcher->stage('last')->add_rule(
+            $dispatcher->stage('after_on')->add_rule(
                 Path::Dispatcher::Rule::Regex->new(
                     regex => $_[0],
                     block => $_[1],

Modified: Path-Dispatcher/trunk/t/004-stages.t
==============================================================================
--- Path-Dispatcher/trunk/t/004-stages.t	(original)
+++ Path-Dispatcher/trunk/t/004-stages.t	Mon Aug 25 16:13:59 2008
@@ -7,9 +7,7 @@
 my @calls;
 
 my $dispatcher = Path::Dispatcher->new;
-for my $stage (qw/before_first first after_first
-                  before_on    on    after_on
-                  before_last  last  after_last/) {
+for my $stage (qw/before_on on after_on/) {
     $dispatcher->stage($stage)->add_rule(
         Path::Dispatcher::Rule::Regex->new(
             regex => qr/foo/,
@@ -19,9 +17,5 @@
 }
 
 $dispatcher->run('foo');
-is_deeply(\@calls, [
-    'before_first', 'first', 'after_first',
-    'before_on',    'on',    'after_on',
-    'before_last',  'last',  'after_last',
-]);
+is_deeply(\@calls, ['before_on', 'on', 'after_on']);
 

Modified: Path-Dispatcher/trunk/t/005-multi-rule.t
==============================================================================
--- Path-Dispatcher/trunk/t/005-multi-rule.t	(original)
+++ Path-Dispatcher/trunk/t/005-multi-rule.t	Mon Aug 25 16:13:59 2008
@@ -7,21 +7,15 @@
 my @calls;
 
 my $dispatcher = Path::Dispatcher->new;
-for my $stage (qw/first on last/) {
-    for my $number (qw/first second/) {
-        $dispatcher->stage($stage)->add_rule(
-            Path::Dispatcher::Rule::Regex->new(
-                regex => qr/foo/,
-                block => sub { push @calls, "$stage: $number" },
-            ),
-        );
-    }
+for my $number (qw/first second/) {
+    $dispatcher->stage('on')->add_rule(
+        Path::Dispatcher::Rule::Regex->new(
+            regex => qr/foo/,
+            block => sub { push @calls, $number },
+        ),
+    );
 }
 
 $dispatcher->run('foo');
-is_deeply(\@calls, [
-    'first: first',
-    'on: first',
-    'last: first',
-]);
+is_deeply(\@calls, ['first']);
 

Modified: Path-Dispatcher/trunk/t/006-abort.t
==============================================================================
--- Path-Dispatcher/trunk/t/006-abort.t	(original)
+++ Path-Dispatcher/trunk/t/006-abort.t	Mon Aug 25 16:13:59 2008
@@ -18,7 +18,7 @@
     ),
 );
 
-$dispatcher->stage('last')->add_rule(
+$dispatcher->stage('on')->add_rule(
     Path::Dispatcher::Rule::Regex->new(
         regex => qr/foo/,
         block => sub {

Modified: Path-Dispatcher/trunk/t/010-return.t
==============================================================================
--- Path-Dispatcher/trunk/t/010-return.t	(original)
+++ Path-Dispatcher/trunk/t/010-return.t	Mon Aug 25 16:13:59 2008
@@ -19,9 +19,7 @@
 my $dispatch = $dispatcher->dispatch('foo');
 is_deeply([$dispatch->run(24)], []);
 
-for my $stage (qw/before_first first after_first
-                  before_on    on    after_on
-                  before_last  last  after_last/) {
+for my $stage (qw/before_on on after_on/) {
     $dispatcher->stage($stage)->add_rule(
         Path::Dispatcher::Rule::Regex->new(
             regex => qr/foo/,



More information about the Bps-public-commit mailing list