[Bps-public-commit] r14674 - in Path-Dispatcher/trunk: lib/Path/Dispatcher t
sartak at bestpractical.com
sartak at bestpractical.com
Wed Jul 30 16:46:12 EDT 2008
Author: sartak
Date: Wed Jul 30 16:46:07 2008
New Revision: 14674
Modified:
Path-Dispatcher/trunk/ (props changed)
Path-Dispatcher/trunk/lib/Path/Dispatcher/Declarative.pm
Path-Dispatcher/trunk/t/100-declarative.t
Path-Dispatcher/trunk/t/101-subclass.t
Log:
r68113 at onn: sartak | 2008-07-30 16:45:32 -0400
Support for super dispatchers in the sugar layer
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 Wed Jul 30 16:46:07 2008
@@ -31,6 +31,11 @@
my $dispatcher = Path::Dispatcher->new;
+ # if this is a subclass, then we want to set up a super dispatcher
+ if ($class ne __PACKAGE__) {
+ $dispatcher->super_dispatcher($class->dispatcher);
+ }
+
return {
dispatcher => sub { $dispatcher },
dispatch => sub {
Modified: Path-Dispatcher/trunk/t/100-declarative.t
==============================================================================
--- Path-Dispatcher/trunk/t/100-declarative.t (original)
+++ Path-Dispatcher/trunk/t/100-declarative.t Wed Jul 30 16:46:07 2008
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More tests => 6;
my @calls;
Modified: Path-Dispatcher/trunk/t/101-subclass.t
==============================================================================
--- Path-Dispatcher/trunk/t/101-subclass.t (original)
+++ Path-Dispatcher/trunk/t/101-subclass.t Wed Jul 30 16:46:07 2008
@@ -14,17 +14,14 @@
'framework after foo',
]);
-TODO: {
- local $TODO = "no layering yet :(";
- Path::Dispatcher::Test::App->run('foo');
- is_deeply([splice @calls], [
- 'app before foo',
- 'framework before foo',
- 'framework on foo',
- 'framework after foo',
- 'app after foo',
- ]);
-}
+Path::Dispatcher::Test::App->run('foo');
+is_deeply([splice @calls], [
+ 'app before foo',
+ 'framework before foo',
+ 'framework on foo',
+ 'framework after foo',
+ 'app after foo',
+]);
Path::Dispatcher::Test::App->dispatcher->add_rule(
regex => qr/foo/,
More information about the Bps-public-commit
mailing list