[Bps-public-commit] r15444 - in Path-Dispatcher/trunk: lib/Path lib/Path/Dispatcher
sartak at bestpractical.com
sartak at bestpractical.com
Mon Aug 25 16:14:36 EDT 2008
Author: sartak
Date: Mon Aug 25 16:14:34 2008
New Revision: 15444
Modified:
Path-Dispatcher/trunk/ (props changed)
Path-Dispatcher/trunk/lib/Path/Dispatcher.pm
Path-Dispatcher/trunk/lib/Path/Dispatcher/Stage.pm
Log:
r70300 at onn: sartak | 2008-08-25 15:44:51 -0400
Begin refactoring the redispatch logic to instead have stages with match_ends_dispatch. If no stage with match_ends_dispatch has a rule that matched, then we'll redispatch.
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:34 2008
@@ -82,14 +82,13 @@
result => $result,
);
- next STAGE if $stage->match_ends_stage;
+ return $dispatch if $stage->match_ends_dispatch;
}
-
- $dispatch->add_redispatch($self->redispatch($path))
- if $stage->allows_redispatch($dispatch)
- && $self->can_redispatch;
}
+ $dispatch->add_redispatch($self->redispatch($path))
+ if $self->can_redispatch;
+
return $dispatch;
}
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:34 2008
@@ -37,23 +37,10 @@
# If we're a before/after (qualified) rule, then yeah, we want to continue
# dispatching. If we're an "on" (unqualified) rule, then no, you only get one.
-sub match_ends_stage {
+sub match_ends_dispatch {
return !shift->is_qualified;
}
-sub allows_redispatch {
- my $self = shift;
- my $dispatch = shift;
-
- return 0 if $self->is_qualified;
-
- for my $match ($dispatch->matches) {
- return 0 if $match->stage->match_ends_stage;
- }
-
- return 1;
-}
-
no Moose;
__PACKAGE__->meta->make_immutable;
More information about the Bps-public-commit
mailing list