Skip Menu |

This queue is for tickets about the Catalyst-View-Component-SubInclude CPAN distribution.

Report information
The Basics
Id: 48251
Status: resolved
Priority: 0/
Queue: Catalyst-View-Component-SubInclude

People
Owner: nilsonsfj [...] cpan.org
Requestors: kane [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.06
Fixed in: 0.07



Subject: subrequest backend brekas for paths that have an :Args attribute
Here's 2 invocations to subrequest; 1 direct, 1 as the subinclude backend: ### direct $ctx->sub_request('/api/esi/site/header.tt', {}, { data => 44 }); ### via subinclude my $sub = $ctx->{'stash'}->{'subinclude'}; my $snippet = $sub->( '/api/esi', qw[site header.tt], { data => 44 } ); The latter breaks by appending the qw[site header.tt] to the arguments passed to ->uri_for. Here's the monkey patch jayk suggested which fixed it (but perhaps in the wrong spot, or with side effects): sub generate_subinclude { my ($class, $c, $path, @params) = @_; my $stash = {}; croak "subincludes through subrequests require Catalyst::Plugin::SubRequest" unless $c->can('sub_request'); my $args = ref $params[0] eq 'ARRAY' ? shift @params : []; my $dispatcher = $c->dispatcher; my ($action) = $dispatcher->_invoke_as_path( $c, $path, $args ); my $uri = $c->uri_for( $action, $args, @params ); ### XXX changes from here on down my $queryparams = {}; if (ref $params[$#params] ) { $queryparams = pop @params; } $c->sub_request( $uri->path, $stash, $queryparams ); }