[Bps-public-commit] r15442 - in Path-Dispatcher/trunk: lib/Path lib/Path/Dispatcher t
sartak at bestpractical.com
sartak at bestpractical.com
Mon Aug 25 16:14:10 EDT 2008
Author: sartak
Date: Mon Aug 25 16:14:08 2008
New Revision: 15442
Modified:
Path-Dispatcher/trunk/ (props changed)
Path-Dispatcher/trunk/lib/Path/Dispatcher.pm
Path-Dispatcher/trunk/lib/Path/Dispatcher/Stage.pm
Path-Dispatcher/trunk/t/008-super-dispatcher.t
Log:
r70298 at onn: sartak | 2008-08-25 15:41:09 -0400
Finally pass all tests by asking stages if we should allow 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:08 2008
@@ -91,7 +91,8 @@
}
$dispatch->add_redispatch($self->redispatch($path))
- if $self->can_redispatch;
+ if $stage->allows_redispatch($dispatch)
+ && $self->can_redispatch;
}
continue {
$self->end_stage(
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:08 2008
@@ -41,6 +41,19 @@
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;
Modified: Path-Dispatcher/trunk/t/008-super-dispatcher.t
==============================================================================
--- Path-Dispatcher/trunk/t/008-super-dispatcher.t (original)
+++ Path-Dispatcher/trunk/t/008-super-dispatcher.t Mon Aug 25 16:14:08 2008
@@ -61,10 +61,7 @@
$sub_dispatcher->run('foo');
is_deeply([splice @calls], [
'sub before_on',
- 'super before_on',
'sub on',
- 'super on',
'sub after_on',
- 'super after_on',
]);
More information about the Bps-public-commit
mailing list