2 Catalyst::Plugin::SubRequest - Make subrequests to actions in Catalyst
5 use Catalyst 'SubRequest';
7 my $res_body = $c->subreq('/test/foo/bar', { template => 'magic.tt' });
9 my $res_body = $c->subreq( {
10 path => '/test/foo/bar',
13 template => 'magic.tt'
16 # Get the full response object
17 my $res = $c->subreq_res('/test/foo/bar', {
18 template => 'mailz.tt'
22 $c->log->warn( $res->content_type );
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)
31 subreq [path as string or hash ref], [stash as hash ref], [parameters as
35 Takes a full path to a path you'd like to dispatch to.
37 If the path is passed as a hash ref then it can include body,
38 action, match and path.
40 An optional second argument as hashref can contain data to put into
41 the stash of the subrequest.
43 An optional third argument as hashref can contain data to pass as
44 parameters to the subrequest.
46 Returns the body of the response.
48 subreq_res [path as string or hash ref], [stash as hash ref],
49 [parameters as hash ref]
52 Like "sub_request()", but returns a full Catalyst::Response object.
58 Marcus Ramberg, "mramberg@cpan.org"
60 Tomas Doran (t0m) "bobtfish@bobtfish.net"
63 Eden Cardim (edenc) "eden@insoli.de"
66 SRI, for writing the awesome Catalyst framework
68 MIYAGAWA, for writing the awesome Plack toolkit
71 Copyright (c) 2005 - 2011 the Catalyst::Plugin::SubRequest "AUTHORS" as
75 This program is free software, you can redistribute it and/or modify it
76 under the same terms as Perl itself.