package Catalyst::Plugin::SubRequest;
use strict;
+use warnings;
use Time::HiRes qw/tv_interval/;
-our $VERSION = '0.13';
+our $VERSION = '0.15';
=head1 NAME
=head1 METHODS
-=over 4
+=over 4
=item subreq [path as string or hash ref], [stash as hash ref], [parameters as hash ref]
If the path is passed as a hash ref then it can include body, action, match and path.
Any additional parameters are put into the stash.
-=back
+=back
=cut
} else {
$request_mods{path} = $path;
}
+ $request_mods{_body} = delete $request_mods{body};
my $fake_engine = bless(
{
my $inner_ctx = $class->prepare;
$inner_ctx->stash($stash || {});
-
-
+
+
$c->stats->profile(
begin => 'subrequest: /' . $path,
comment => '',
- ) if ($c->debug);
-
+ ) if ($c->debug);
+
$inner_ctx->dispatch;
$c->stats->profile( end => 'subrequest: /' . $path ) if ($c->debug);
-
+
return $inner_ctx->response->body;
}
L<Catalyst>.
-=head1 AUTHOR
+=head1 AUTHORS
Marcus Ramberg, C<mramberg@cpan.org>
+Tomas Doran (t0m) C<< bobtfish@bobtfish.net >>
+
=head1 THANK YOU
SRI, for writing the awesome Catalyst framework
=head1 COPYRIGHT
+Copyright (c) 2005 - 2008
+the Catalyst::Plugin::SubRequest L</AUTHORS>
+as listed above.
+
+=head1 LICENSE
+
This program is free software, you can redistribute it and/or modify it under
the same terms as Perl itself.
sub prepare {
my ($self, $c) = @_;
my $req = $c->request;
-
+
@{$req}{keys %{$self->{orig_request}}} = values %{$self->{orig_request}};
while (my ($key,$value) = each %{$self->{request_mods}}) {
if (my $mut = $req->can($key)) {