[Bps-public-commit] Path-Dispatcher branch, master, updated. 3f44b9aeb07119f8232180ac2cf696eb520cf145

sartak at bestpractical.com sartak at bestpractical.com
Fri Nov 6 20:48:17 EST 2009


The branch, master has been updated
       via  3f44b9aeb07119f8232180ac2cf696eb520cf145 (commit)
       via  bebbcd409d413eee785df4b901c85db614b60750 (commit)
      from  15aaf42a5872be7bb4fcc7de294099393c539b5d (commit)

Summary of changes:
 lib/Path/Dispatcher.pm |    3 ---
 t/023-lazy-dispatch.t  |   23 +++++++++++++++++++++++
 2 files changed, 23 insertions(+), 3 deletions(-)
 create mode 100644 t/023-lazy-dispatch.t

- Log -----------------------------------------------------------------
commit bebbcd409d413eee785df4b901c85db614b60750
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Oct 16 16:25:40 2009 -0400

    Add failing test for lazy dispatch

diff --git a/t/023-lazy-dispatch.t b/t/023-lazy-dispatch.t
new file mode 100644
index 0000000..588fe72
--- /dev/null
+++ b/t/023-lazy-dispatch.t
@@ -0,0 +1,23 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More tests => 1;
+use Path::Dispatcher;
+
+my @calls;
+
+my $dispatcher = Path::Dispatcher->new;
+$dispatcher->add_rule(
+    Path::Dispatcher::Rule::Tokens->new(
+        tokens => ['hello'],
+        block  => sub { push @calls, 'hello' },
+    ),
+    Path::Dispatcher::Rule::CodeRef->new(
+        matcher => sub { fail("should never run") },
+        block  => sub { push @calls, 'fail' },
+    ),
+);
+
+$dispatcher->run('foo bar');
+is_deeply([splice @calls], ['hello']);
+

commit 3f44b9aeb07119f8232180ac2cf696eb520cf145
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Fri Oct 16 18:56:09 2009 -0400

    Remove commented out code

diff --git a/lib/Path/Dispatcher.pm b/lib/Path/Dispatcher.pm
index 97175eb..7de099b 100644
--- a/lib/Path/Dispatcher.pm
+++ b/lib/Path/Dispatcher.pm
@@ -55,9 +55,6 @@ sub dispatch_rule {
 
     my @matches = $args{rule}->match($args{path});
 
-    # Support ::Chain here? Probably not. As ::Chain doesn't make sense unless it is within an ::Under
-#    return if $matches[-1]->rule->isa('Path::Dispatcher::Rule::Chain'); 
-    
     $args{dispatch}->add_matches(@matches);
 
     return @matches;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list