[Bps-public-commit] r14714 - in Path-Dispatcher/trunk: lib/Path t
sartak at bestpractical.com
sartak at bestpractical.com
Fri Aug 1 13:56:48 EDT 2008
Author: sartak
Date: Fri Aug 1 13:56:12 2008
New Revision: 14714
Modified:
Path-Dispatcher/trunk/ (props changed)
Path-Dispatcher/trunk/lib/Path/Dispatcher.pm
Path-Dispatcher/trunk/t/008-super-dispatcher.t
Log:
r68287 at onn: sartak | 2008-08-01 13:55:28 -0400
Support for named dispatchers
Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher.pm (original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher.pm Fri Aug 1 13:56:12 2008
@@ -25,6 +25,17 @@
predicate => 'has_super_dispatcher',
);
+has name => (
+ is => 'rw',
+ isa => 'Str',
+ default => do {
+ my $i = 0;
+ sub {
+ join '-', __PACKAGE__, ++$i;
+ },
+ },
+);
+
sub add_rule {
my $self = shift;
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 Fri Aug 1 13:56:12 2008
@@ -1,7 +1,7 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 7;
use Path::Dispatcher;
my @calls;
@@ -11,6 +11,8 @@
super_dispatcher => $super_dispatcher,
);
+isnt($super_dispatcher->name, $sub_dispatcher->name, "two dispatchers have separate names");
+
ok(!$super_dispatcher->has_super_dispatcher, "no super dispatcher by default");
ok($sub_dispatcher->has_super_dispatcher, "sub dispatcher has a super");
is($sub_dispatcher->super_dispatcher, $super_dispatcher, "the super dispatcher is correct");
More information about the Bps-public-commit
mailing list