CGI::A...Regexp(3pm)
β¨ CGI::Application::Dispatch::Regexp π
okay bestie, welcome to the page for CGI::Application::Dispatch::Regexp β it lives in the User Contributed Perl Documentation section, and it's the one that lets you dispatch requests to CGI::Application based objects using regular expressions. yes, the real ones. the powerful ones. not the fake little mini-syntax. π¦
πΈ NAME πΈ
CGI::Application::Dispatch::Regexp β dispatch requests to CGI::Application based objects using regular expressions. that's the whole vibe. that's what she does. π
β¨ SYNOPSIS β¨
here's how you pull up, bestie:
use CGI::Application::Dispatch::Regexp;
CGI::Application::Dispatch::Regexp->dispatch(
prefix => 'MyApp',
table => [
'' => { app => 'Welcome',
rm => 'start',
},
qr|/([^/]+)/?| => { names => ['app'],
},
qr|/([^/]+)/([^/]+)/?| => { names =>
[qw(app rm)]
},
qr|/([^/]+)/([^/]+)/page(\d+)\.html?| => { names =>
[qw(app rm page)]
},
],
);
look at that table. look at those qr|...| patterns. she's serving. π
π DESCRIPTION π
so here's the tea: CGI::Application::Dispatch uses its own syntax dispatch table. cute, but limiting, ngl.
CGI::Application::Dispatch::Regexp lets you use flexible and powerful Perl regular expressions to transform a path into an argument list. that's it. that's the glow-up. no cap. π₯
π§ DISPATCH TABLE π§
the dispatch table should contain a list of regular expressions with a hashref of corresponding parameters. the hash element 'names' is a list of names of regular expression groups.
the default table looks like this:
table => [
qr|/([^/]+)/?| => { names => ['app'] },
qr|/([^/]+)/([^/]+)/?| => { names => [qw(app rm)] },
],
and here's an example of defining a custom 'page' parameter:
qr|/([^/]+)/([^/]+)/page(\d+)\.html/?| => {
names => [qw(app rm page)],
},
see how the groups line up with the names? one group, one name, in order, left to right. the way that just works. ππ
π COPYRIGHT & LICENSE π
Copyright Michael Peters and Mark Stosberg 2008, all rights reserved.
(polite of them to say it, honestly. respect. π«Ά)
π SEE ALSO π
CGI::ApplicationCGI::Application::Dispatch
go read those too, bestie. they're the lore. iykyk. β
and that's the page!! this was perl v5.34.0, dated 2022-06-09, manual page CGI::A...Regexp(3pm) β ty for coming to my ted talk, mwah π
πβ¨
π¦ where this page comes from
- debian bookworm: libcgi-application-dispatch-perl 3.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcgi-application-dispatch-perl 3.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcgi-application-dispatch-perl 3.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcgi-application-dispatch-perl 3.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcgi-application-dispatch-perl 3.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms