Path::Dispatcher::Dispatch(3pm)

Path::Dispatcher::Dispatch3pm

A list of matches

Usage

    my $dispatcher = Path::Dispatcher->new(
        rules => [
            Path::Dispatcher::Rule::Tokens->new(
                tokens => [ 'attack', qr/^\w+$/ ],
                block  => sub { attack(shift->pos(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

Version

version 1.08

Overview

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

Attributes

matches

The list of Path::Dispatcher::Match that correspond to the rules that were matched.

Methods

run

Executes the first match.

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

Support

Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Path-Dispatcher> (or [email protected] <mailto:[email protected]>).

Releases

7 releases since Debian 6.0 (Squeeze); the text changed 3 times.

  1. 6.0
  2. 7
  3. 8–9
  4. 11–13

Author

Shawn M Moore, "<sartak at bestpractical.com>"

From libpath-dispatcher-perl 1.08-2 in Debian 13 (Trixie). Parsed by carta from the page's man source.