[Bps-public-commit] r16393 - in Path-Dispatcher/trunk: lib/Path/Dispatcher
sartak at bestpractical.com
sartak at bestpractical.com
Mon Oct 20 10:50:44 EDT 2008
Author: sartak
Date: Mon Oct 20 10:50:43 2008
New Revision: 16393
Modified:
Path-Dispatcher/trunk/ (props changed)
Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm
Log:
r74202 at onn: sartak | 2008-10-20 10:50:35 -0400
Dispatch doc, that covers all of the classes
Modified: Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm
==============================================================================
--- Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm (original)
+++ Path-Dispatcher/trunk/lib/Path/Dispatcher/Dispatch.pm Mon Oct 20 10:50:43 2008
@@ -60,3 +60,47 @@
1;
+__END__
+
+=head1 NAME
+
+Path::Dispatcher::Dispatch - a list of matches
+
+=head1 SYNOPSIS
+
+ my $dispatcher = Path::Dispatcher->new(
+ rules => [
+ Path::Dispatcher::Rule::Tokens->new(
+ tokens => [ 'attack', qr/^\w+$/ ],
+ block => sub { attack($2) },
+ ),
+ ],
+ );
+
+ my $dispatch = $dispatcher->dispatch("attack goblin");
+
+ $dispatch->matches; # list of matches (in this case, one)
+ $dispatch->has_matches; # whether there were any matches
+
+ $dispatch->run; # attacks the goblin
+
+=head1 DESCRIPTION
+
+Dispatching creates a C<dispatch> which is little more than a (possibly empty!)
+list of matches.
+
+=head1 ATTRIBUTES
+
+=head2 matches
+
+The list of L<Path::Dispatcher::Match> that correspond to the rules that were
+matched.
+
+=head1 METHODS
+
+=head2 run
+
+Executes matches until a match's C<ends_dispatch> returns true.
+
+=cut
+
More information about the Bps-public-commit
mailing list