Path::...spatch(3pm)

πŸ“¦
version 1.08 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Path::...spatch β€” the manual, bestie edition πŸ’–

okay so you're in the Path::Dispatcher docs (that's the Path::...spatch(3pm) situation, from User Contributed Perl Documentation), and honestly? slay. let's get into it. ✨


🌸 NAME 🌸

Path::Dispatcher::Dispatch β€” literally just a list of matches. that's it. that's the whole vibe. πŸ‘‘


πŸŽ€ VERSION πŸŽ€

version 1.08 β€” periodt. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the tea, copy it exactly bestie:

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
not me writing a whole dispatcher just to attack a goblin 😭 but like… it works. it ate.

🌈 DESCRIPTION 🌈

so when you dispatch, you get a "dispatch" back, and a dispatch is little more than a list of matches. and yes bestie β€” possibly empty! πŸ™ˆ the list can be empty. that's a real possibility. no cap.


πŸ’œ ATTRIBUTES πŸ’œ

⭐ matches

the list of Path::Dispatcher::Match that correspond to the rules that were matched. that's your roster. your main characters. your matched set. 🫢


✨ METHODS ✨

πŸ”₯ run

executes the first match. like, the first one. not all of them. the first. okay? okay. πŸ’…

each match's "run" in Path::Dispatcher::Match method gets evaluated in scalar context. the return value of this method is a list of these scalars β€” or the first one if you called it in scalar context. iykyk. πŸ“


🧚 SUPPORT 🧚

bugs may be submitted through the RT bug tracker at:

https://rt.cpan.org/Public/Dist/Display.html?Name=Path-Dispatcher

or you can email bug-Path-Dispatcher@rt.cpan.org β€” do it, bestie, they wanna hear from you. πŸ’–


πŸ‘‘ AUTHOR πŸ‘‘

Shawn M Moore, "<sartak at bestpractical.com>" β€” iconic behavior fr fr. 🌟


this software is copyright (c) 2020 by Shawn M Moore.

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so like… go off. πŸŽ€


and that's the whole page, bestie 🫢 this doc came from perl v5.30.3, dated 2020-07-13, and it's the Path::...spatch(3pm) page β€” love that for us. mwah. πŸ’‹βœ¨

πŸ“¦ where this page comes from