| 1 |
NAME |
| 2 |
Catalyst::Plugin::SubRequest - Make subrequests to actions in Catalyst |
| 3 |
|
| 4 |
SYNOPSIS |
| 5 |
use Catalyst 'SubRequest'; |
| 6 |
|
| 7 |
my $res_body = $c->subreq('/test/foo/bar', { template => 'magic.tt' }); |
| 8 |
|
| 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 ); |
| 23 |
|
| 24 |
DESCRIPTION |
| 25 |
Make subrequests to actions in Catalyst. Uses the catalyst dispatcher, |
| 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. |
| 29 |
|
| 30 |
METHODS |
| 31 |
subreq [path as string or hash ref], [stash as hash ref], [parameters as |
| 32 |
hash ref] |
| 33 |
subrequest |
| 34 |
sub_request |
| 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. |
| 53 |
|
| 54 |
SEE ALSO |
| 55 |
Catalyst. |
| 56 |
|
| 57 |
AUTHORS |
| 58 |
Marcus Ramberg, "[email protected]" |
| 59 |
|
| 60 |
Tomas Doran (t0m) "[email protected]" |
| 61 |
|
| 62 |
MAINTAINERS |
| 63 |
Eden Cardim (edenc) "[email protected]" |
| 64 |
|
| 65 |
THANK YOU |
| 66 |
SRI, for writing the awesome Catalyst framework |
| 67 |
|
| 68 |
MIYAGAWA, for writing the awesome Plack toolkit |
| 69 |
|
| 70 |
COPYRIGHT |
| 71 |
Copyright (c) 2005 - 2011 the Catalyst::Plugin::SubRequest "AUTHORS" as |
| 72 |
listed above. |
| 73 |
|
| 74 |
LICENSE |
| 75 |
This program is free software, you can redistribute it and/or modify it |
| 76 |
under the same terms as Perl itself. |
| 77 |
|