1Catalyst::View::ComponeUnste:r:SCuobnItnrciClbauutdtaeel:dy:sHPtTe:Tr:PlV(i3De)owc:u:mCeonmtpaotnieonnt::SubInclude::HTTP(3)
2
3
4

NAME

6       Catalyst::View::Component::SubInclude::HTTP - HTTP plugin for
7       C::V::Component::SubInclude
8

SYNOPSIS

10       In your view class:
11
12           package MyApp::View::TT;
13           use Moose;
14
15           extends 'Catalyst::View::TT';
16           with 'Catalyst::View::Component::SubInclude';
17
18           __PACKAGE__->config(
19               subinclude_plugin => 'HTTP::GET',
20               subinclude => {
21                   'HTTP::GET' => {
22                       class => 'HTTP',
23                       http_method => 'GET',
24                       ua_timeout => '10',
25                       uri_map => {
26                           '/my/' => 'http://localhost:5000/',
27                       },
28                   },
29                   'HTTP::POST' => {
30                       class => 'HTTP',
31                       http_method => 'POST',
32                       ua_timeout => '10',
33                       uri_map => {
34                           '/foo/' => 'http://www.foo.com/',
35                       },
36                   },
37               },
38           );
39
40       Then, somewhere in your templates:
41
42           [% subinclude('/my/widget') %]
43           ...
44           [% subinclude_using('HTTP::POST', '/foo/path', { foo => 1 }) %]
45

DESCRIPTION

47       "Catalyst::View::Component::SubInclude::HTTP" does HTTP requests
48       (currently using LWP::UserAgent) and uses the responses to render
49       subinclude contents.
50

CONFIGURATION

52       The configuration is passed in the "subinclude" key based on your
53       plugin name which can be arbitrary.
54
55       class
56           Required just in case your plugin name differs from "HTTP".
57
58       http_method
59           Accepts "GET" and "POST" as values. The default one is "GET".
60
61       user_agent
62           This lazily builds a LWP::UserAgent obj, however you can pass a
63           different user agent obj that implements the required API.
64
65       ua_timeout
66           User Agent's timeout config param. Defaults to 10 seconds.
67
68       uri_map
69           This expects a HashRef in order to map paths to different URLs.
70
71       base_url
72           Used only if "uri_map" is "undef" and defaults to
73           "$c->request->base".
74

METHODS

76   "generate_subinclude( $c, $path, $args )"
77       Note that $path should be the relative path.
78

SEE ALSO

80       Catalyst::View::Component::SubInclude
81

AUTHOR

83       Wallace Reis "<wreis@cpan.org>"
84

SPONSORSHIP

86       Development sponsored by Ionzero LLC <http://www.ionzero.com/>.
87
89       Copyright (c) 2010 Wallace Reis.
90
91       This program is free software; you can redistribute it and/or modify it
92       under the same terms as Perl itself.
93
94
95
96perl v5.36.0                    Ca2t0a2l2y-s0t7:-:2V2iew::Component::SubInclude::HTTP(3)
Impressum