1Path::Dispatcher::DispaUtscehr(3Cpomn)tributed Perl DocuPmaetnht:a:tDiiosnpatcher::Dispatch(3pm)
2
3
4

NAME

6       Path::Dispatcher::Dispatch - a list of matches
7

VERSION

9       version 1.08
10

SYNOPSIS

12           my $dispatcher = Path::Dispatcher->new(
13               rules => [
14                   Path::Dispatcher::Rule::Tokens->new(
15                       tokens => [ 'attack', qr/^\w+$/ ],
16                       block  => sub { attack(shift->pos(2)) },
17                   ),
18               ],
19           );
20
21           my $dispatch = $dispatcher->dispatch("attack goblin");
22
23           $dispatch->matches;     # list of matches (in this case, one)
24           $dispatch->has_matches; # whether there were any matches
25
26           $dispatch->run; # attacks the goblin
27

DESCRIPTION

29       Dispatching creates a "dispatch" which is little more than a (possibly
30       empty!)  list of matches.
31

ATTRIBUTES

33   matches
34       The list of Path::Dispatcher::Match that correspond to the rules that
35       were matched.
36

METHODS

38   run
39       Executes the first match.
40
41       Each match's "run" in Path::Dispatcher::Match method is evaluated in
42       scalar context. The return value of this method is a list of these
43       scalars (or the first if called in scalar context).
44

SUPPORT

46       Bugs may be submitted through the RT bug tracker
47       <https://rt.cpan.org/Public/Dist/Display.html?Name=Path-Dispatcher> (or
48       bug-Path-Dispatcher@rt.cpan.org <mailto:bug-Path-
49       Dispatcher@rt.cpan.org>).
50

AUTHOR

52       Shawn M Moore, "<sartak at bestpractical.com>"
53
55       This software is copyright (c) 2020 by Shawn M Moore.
56
57       This is free software; you can redistribute it and/or modify it under
58       the same terms as the Perl 5 programming language system itself.
59
60
61
62perl v5.36.0                      2023-01-20   Path::Dispatcher::Dispatch(3pm)
Impressum