[Bps-public-commit] Path-Dispatcher branch, master, updated. 0c749f2bbf013bf00e44a67432bef1afbd7a1996
sartak at bestpractical.com
sartak at bestpractical.com
Tue Feb 24 15:58:19 EST 2009
The branch, master has been updated
via 0c749f2bbf013bf00e44a67432bef1afbd7a1996 (commit)
from a658d28a3c6da24bd52ded2ba10dca6f06038bb6 (commit)
Summary of changes:
lib/Path/Dispatcher/Cookbook.pod | 16 ++++------------
1 files changed, 4 insertions(+), 12 deletions(-)
- Log -----------------------------------------------------------------
commit 0c749f2bbf013bf00e44a67432bef1afbd7a1996
Author: Shawn M Moore <sartak at gmail.com>
Date: Tue Feb 24 15:58:07 2009 -0500
Update the Cookbook with "then", some verbiage
diff --git a/lib/Path/Dispatcher/Cookbook.pod b/lib/Path/Dispatcher/Cookbook.pod
index 0649adf..65f04e2 100644
--- a/lib/Path/Dispatcher/Cookbook.pod
+++ b/lib/Path/Dispatcher/Cookbook.pod
@@ -17,21 +17,15 @@ In your Dispatcher object, define the C<token_delimiter> subroutine to return a
=head2 How can I do rule chaining (like in Catalyst)?
-You can use a L<Path::Dispatcher::Rule::Always> rule in combination with C<next_rule> to get chaining behavior:
+You can use a C<then> rule approximate chaining behavior:
package MyDispatcher;
use Path::Dispatcher::Declarative -base;
under show => sub {
- $Path::Dispatcher::Declarative::UNDER_RULE->add_rule(
- Path::Dispatcher::Rule::Always->new(
- stage => 'on',
- block => sub {
- print "Displaying ";
- next_rule;
- },
- ),
- );
+ then {
+ print "Displaying ";
+ };
on inventory => sub {
print "inventory:\n";
...
@@ -48,6 +42,4 @@ You can use a L<Path::Dispatcher::Rule::Always> rule in combination with C<next_
MyDispatcher->run("display score"); # "Displaying score\n ..."
-It's a little bit ugly, but it works
-
=cut
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list