Cataly...rowsers(3pm)
π Cataly...rowsers β Catalyst::Action::REST::ForBrowsers π
okay so bestie, welcome to the 3pm manual, straight outta the User Contributed Perl Documentation section β¨ this one's called Catalyst::Action::REST::ForBrowsers, and no the name isn't glitching, that's just how manpages abbreviate things when they're feeling shy π
πΈ NAME πΈ
Catalyst::Action::REST::ForBrowsers β Automated REST Method Dispatching that Accommodates Browsers
like, it does the REST dispatching thing for you, but it's nice about it when browsers show up π¦
β¨ SYNOPSIS β¨
sub foo :Local :ActionClass('REST::ForBrowsers') {
... do setup for HTTP method specific handlers ...
}
sub foo_GET : Private {
... do something for GET requests ...
}
sub foo_GET_html : Private {
... do something for GET requests from browsers ...
}
sub foo_PUT : Private {
... do something for PUT requests ...
}
see how you just declare the handlers and it figures out who gets the vibe check? iconic behavior fr fr π
π DESCRIPTION π
okay so this class subclasses Catalyst::Action::REST to add one extra dispatching hook. that's the whole glow-up. β¨
here's the tea: if the request is a GET request AND the request looks like it came from a browser, it tries to dispatch to a GET_html method before trying the GET method instead. and every other HTTP method? dispatched the same way. no cap. π
so for example, in the synopsis up there, calling GET on /foo from a browser ends up calling the foo_GET_html method. if the request is not from a browser, it calls foo_GET. simple as that π«Ά
see Catalyst::Action::REST for more details on dispatching details, because that's where the real lore lives π
π§ METHODS π§
dispatchβ this method overrides the default dispatch mechanism and swaps in the re-dispatching mechanism we just described above. it's giving main character energy, honestly π
π« SEE ALSO π«
you probably want to look at Catalyst::Controller::REST, which implements a sensible set of defaults for a controller doing REST. highly recommend, 10/10 π
and heads up: this class automatically adds the Catalyst::TraitFor::Request::REST::ForBrowsers role to your request class. no setup needed, it just does it. obsessed π
π CONTRIBUTORS π
- Dave Rolsky
<autarch@urth.org>
thank you for your service π«‘π
π COPYRIGHT π
Copyright the above named AUTHOR and CONTRIBUTORS
π LICENSE π
You may distribute this code under the same terms as Perl itself.
and that's the whole page bestie, go build something cute π¦
signing off from perl v5.40.1, dated 2026-05-07 β mwah π β¨
π¦ where this page comes from
- ubuntu stonking: libcatalyst-action-rest-perl 1.22-1 Β· 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