use warnings;
use strict;
+use Carp qw/croak/;
+use namespace::clean qw/croak/;
+
=head1 NAME
Catalyst::View::Component::SubInclude::SubRequest - Sub-requests plugin for C::V::Component::SubInclude
=head1 VERSION
-Version 0.01
+Version 0.02
=cut
-our $VERSION = '0.01';
+our $VERSION = '0.02';
=head1 SYNOPSIS
It requires L<Catalyst::Plugin::SubRequest>.
-=head1 STASH FUNCTION
+=head1 CLASS METHODS
-=head2 C<subinclude( $path, @args )>
+=head2 C<generate_subinclude( $c, $path, @args )>
This will translate to the following sub-request call:
croak "subincludes through subrequests require Catalyst::Plugin::SubRequest"
unless $c->can('sub_request');
+
+ my $dispatcher = $c->dispatcher;
+ my ($action, $args) = $dispatcher->_invoke_as_path( $c, $path, @params );
+
+ my $uri = $c->uri_for( $action, $args );
- $c->sub_request( $path, $stash, @params );
+ $c->sub_request( $uri->path, $stash, @params );
}
=head1 SEE ALSO