Catalyst::View::Component::SubInclude::HTTP(3pm) | User Contributed Perl Documentation | Catalyst::View::Component::SubInclude::HTTP(3pm) |
Catalyst::View::Component::SubInclude::HTTP - HTTP plugin for C::V::Component::SubInclude
In your view class:
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/', }, }, }, );
Then, somewhere in your templates:
[% subinclude('/my/widget') %] ... [% subinclude_using('HTTP::POST', '/foo/path', { foo => 1 }) %]
"Catalyst::View::Component::SubInclude::HTTP" does HTTP requests (currently using LWP::UserAgent) and uses the responses to render subinclude contents.
The configuration is passed in the "subinclude" key based on your plugin name which can be arbitrary.
Note that $path should be the relative path.
Catalyst::View::Component::SubInclude
Wallace Reis "<wreis@cpan.org>"
Development sponsored by Ionzero LLC <http://www.ionzero.com/>.
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.
2022-06-09 | perl v5.34.0 |