Path::...::Regex(3pm)

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

✨ Path::...::Regex β€” the perl manual page, bestie edition ✨

okay so this is a User Contributed Perl Documentation page for Path::...::Regex(3pm), and we're gonna get through it together, no cap. Grab a strawberry πŸ“, sit down, it's giving documentation but make it cute.


🌸 NAME 🌸

Path::Dispatcher::Rule::Regex β€” the predicate is a regular expression πŸ’…

πŸŽ€ VERSION πŸŽ€

version 1.08

πŸ¦‹ SYNOPSIS πŸ¦‹

my $rule = Path::Dispatcher::Rule::Regex->new(
    regex => qr{^/comment(s?)/(\d+)$},
    block => sub { display_comment(shift->pos(2)) },
);

literally that's the whole vibe. you build a rule, you hand it a regex, you hand it a block, and it goes πŸƒβ€β™€οΈβœ¨

πŸ’– DESCRIPTION πŸ’–

Rules of this class use a regular expression to match against the path. that's it, that's the whole thing, it ate and left no crumbs πŸ‘‘

🌈 ATTRIBUTES 🌈

⭐ regex ⭐

The regular expression to match against the path. It works just as you'd expect! iconic behavior honestly.

The capture variables ($1, $2, etc) will be available in the match object as ->pos(1) etc. so like, you match (\d+) and then you can pull it back out with ->pos(2) β€” slay 🫢

⚠️ but bestie, listen: $` , $&, and $' are not restored. that's just how it is. no cap.

🧚 SUPPORT 🧚

Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Path-Dispatcher> (or bug-Path-Dispatcher@rt.cpan.org <mailto:bug-Path-Dispatcher@rt.cpan.org>). if something's broken, tell the nice people, don't just suffer in silence 😭

πŸ‘‘ AUTHOR πŸ‘‘

Shawn M M<sup>oo</sup>re, "<sartak at bestpractical.com>" β€” main character energy fr fr

(okay the superscript is me being silly, the name is just Shawn M Moore and the email string is exactly "<sartak at bestpractical.com>" πŸ’œ)

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.


and that's the whole page, bestie, you understood it, i'm so proud πŸ₯ΉπŸ’…βœ¨

this little gem was written against perl v5.30.3, dated 2020-07-13, and it's filed under Path::...::Regex(3pm). periodt. πŸŒΈπŸ¦‹πŸ’–

πŸ“¦ where this page comes from