Commit | Line | Data |
aae30f91 |
1 | NAME |
ad73ee58 |
2 | Catalyst::Plugin::SubRequest - Make subrequests to actions in Catalyst |
aae30f91 |
3 | |
4 | SYNOPSIS |
ad73ee58 |
5 | use Catalyst 'SubRequest'; |
aae30f91 |
6 | |
d7361335 |
7 | my $res_body = $c->subreq('/test/foo/bar', { template => 'magic.tt' }); |
ad73ee58 |
8 | |
d7361335 |
9 | my $res_body = $c->subreq( { |
10 | path => '/test/foo/bar', |
11 | body => $body |
12 | }, { |
13 | template => 'magic.tt' |
14 | }); |
15 | |
16 | # Get the full response object |
17 | my $res = $c->subreq_res('/test/foo/bar', { |
18 | template => 'mailz.tt' |
19 | }, { |
20 | param1 => 23 |
21 | }); |
22 | $c->log->warn( $res->content_type ); |
aae30f91 |
23 | |
24 | DESCRIPTION |
ad73ee58 |
25 | Make subrequests to actions in Catalyst. Uses the catalyst dispatcher, |
d7361335 |
26 | so it will work like an external url call. Methods are provided both to |
27 | get the body of the response and the full response (Catalyst::Response) |
28 | object. |
ad73ee58 |
29 | |
30 | METHODS |
31 | subreq [path as string or hash ref], [stash as hash ref], [parameters as |
32 | hash ref] |
d7361335 |
33 | subrequest |
ad73ee58 |
34 | sub_request |
d7361335 |
35 | Takes a full path to a path you'd like to dispatch to. |
36 | |
37 | If the path is passed as a hash ref then it can include body, |
38 | action, match and path. |
39 | |
40 | An optional second argument as hashref can contain data to put into |
41 | the stash of the subrequest. |
42 | |
43 | An optional third argument as hashref can contain data to pass as |
44 | parameters to the subrequest. |
45 | |
46 | Returns the body of the response. |
47 | |
48 | subreq_res [path as string or hash ref], [stash as hash ref], |
49 | [parameters as hash ref] |
50 | subrequest_response |
51 | sub_request_response |
52 | Like "sub_request()", but returns a full Catalyst::Response object. |
aae30f91 |
53 | |
aae30f91 |
54 | SEE ALSO |
55 | Catalyst. |
56 | |
de181610 |
57 | AUTHORS |
ad73ee58 |
58 | Marcus Ramberg, "mramberg@cpan.org" |
59 | |
de181610 |
60 | Tomas Doran (t0m) "bobtfish@bobtfish.net" |
61 | |
ad73ee58 |
62 | THANK YOU |
63 | SRI, for writing the awesome Catalyst framework |
aae30f91 |
64 | |
65 | COPYRIGHT |
d7361335 |
66 | Copyright (c) 2005 - 2011 the Catalyst::Plugin::SubRequest "AUTHORS" as |
61114b68 |
67 | listed above. |
68 | |
69 | LICENSE |
aae30f91 |
70 | This program is free software, you can redistribute it and/or modify it |
71 | under the same terms as Perl itself. |
72 | |