Cataly...e::HTTP(3pm)
π Catalyst::View::Component::SubInclude::HTTP β the perl manual page, bestie edition
okay so hi, welcome to the Cataly...e::HTTP(3pm) page π β that's a perl manual section 3pm situation, and it's literally the HTTP plugin for C::V::Component::SubInclude. Let's get into it.
β¨ NAME β¨
Catalyst::View::Component::SubInclude::HTTP β the HTTP plugin for C::V::Component::SubInclude π¦
πΈ SYNOPSIS πΈ
So like, in your view class, you do this:
package MyApp::View::TT;
use Moose;
extends 'Catalyst::View::TT';
with 'Catalyst::View::Component::SubInclude';
__PACKAGE__->config(
subinclude_plugin => 'HTTP::GET',
subinclude => {
'HTTP::GET' => {
class => 'HTTP',
http_method => 'GET',
ua_timeout => '10',
uri_map => {
'/my/' => 'http://localhost:5000/',
},
},
'HTTP::POST' => {
class => 'HTTP',
http_method => 'POST',
ua_timeout => '10',
uri_map => {
'/foo/' => 'http://www.foo.com/',
},
},
},
);
and then, somewhere in your templates, you just π drop these in:
[% subinclude('/my/widget') %]
...
[% subinclude_using('HTTP::POST', '/foo/path', { foo => 1 }) %]
slay. that's the whole vibe.
π DESCRIPTION π
Catalyst::View::Component::SubInclude::HTTP does HTTP requests (currently using LWP::UserAgent, iykyk) and then uses the responses to render subinclude contents. that's it, that's the job, and it does it well π
π CONFIGURATION π
the config gets passed in the subinclude key, based on your plugin name β and your plugin name can be literally whatever you want, it's arbitrary, main character energy β¨
classβ Required, just in case your plugin name isn'tHTTP. (Like, it's fine, names are hard.)http_methodβ AcceptsGETandPOSTas values. The default one isGET. πuser_agentβ This lazily builds anLWP::UserAgentobj, but lowkey you can pass a different user agent obj that implements the required API. do your thing πua_timeoutβ The User Agent's timeout config param. Defaults to10seconds. β³uri_mapβ This expects a HashRef so you can map paths to different URLs. very demure, very mindful πΊοΈbase_urlβ Used only ifuri_mapisundef, and it defaults to$c->request->base. π
β METHODS β
π« generate_subinclude( $c, $path, $args )
just a lil heads up bestie: $path should be the relative path. no cap, keep it relative π«Ά
π SEE ALSO π
Catalyst::View::Component::SubInclude β go read it, it's the parent vibe π
π AUTHOR π
Wallace Reis <wreis@cpan.org> β icon, legend, the moment β¨
πΈ SPONSORSHIP πΈ
Development sponsored by Ionzero LLC <http://www.ionzero.com/>. periodt π
π COPYRIGHT & LICENSE π
Copyright (c) 2010 Wallace Reis.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, babe π it came from perl v5.34.0 and it's dated 2022-06-09 β shoutout to that build, she ate. mwah, go render some subincludes πβ¨
π¦ where this page comes from
- debian bookworm: libcatalyst-view-component-subinclude-perl 0.10-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatalyst-view-component-subinclude-perl 0.10-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatalyst-view-component-subinclude-perl 0.10-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatalyst-view-component-subinclude-perl 0.10-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatalyst-view-component-subinclude-perl 0.10-4 Β· 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