[Bps-public-commit] Path-Dispatcher branch, master, updated. 418e7e91ebb4e86bbdcfd3b9ef93b06669aa2f09

Shawn Moore sartak at bestpractical.com
Sun Oct 17 04:51:16 EDT 2010


The branch, master has been updated
       via  418e7e91ebb4e86bbdcfd3b9ef93b06669aa2f09 (commit)
      from  b8f4b3fe15ce9d1b7bca0178ea30dd5a54cf5bf1 (commit)

Summary of changes:
 lib/Path/Dispatcher/Rule/Chain.pm |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

- Log -----------------------------------------------------------------
commit 418e7e91ebb4e86bbdcfd3b9ef93b06669aa2f09
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Sun Oct 17 17:51:06 2010 +0900

    Don't use the setter in Chain

diff --git a/lib/Path/Dispatcher/Rule/Chain.pm b/lib/Path/Dispatcher/Rule/Chain.pm
index 6e21270..74f0e3f 100644
--- a/lib/Path/Dispatcher/Rule/Chain.pm
+++ b/lib/Path/Dispatcher/Rule/Chain.pm
@@ -2,17 +2,19 @@ package Path::Dispatcher::Rule::Chain;
 use Any::Moose;
 extends 'Path::Dispatcher::Rule::Always';
 
-sub BUILD {
-    my $self = shift;
+override block => sub {
+    my $self  = shift;
+    my $block = super;
 
-    if ($self->has_block) {
-        my $block = $self->block;
-        $self->block(sub {
+    if (!@_) {
+        return sub {
             $block->(@_);
             die "Path::Dispatcher next rule\n"; # FIXME From Path::Dispatcher::Declarative... maybe this should go in a common place?
-        });
+        };
     }
-}
+
+    return $block;
+};
 
 __PACKAGE__->meta->make_immutable;
 no Any::Moose;

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



More information about the Bps-public-commit mailing list