John Napiorkowski wrote:
--- Ash Berlin <[EMAIL PROTECTED]> wrote:
This has been discussed before, tho a fully
satisfactory solution never
appeared. Something that we touched upon that could
work was to have a
stack of actions which been used/hit in the chain -
though this wouldn't
help when going cross controller.
But yes, its something that has been niggling me as
well.
Ash
I came up with this hack that worked for my client,
but it's dependent on the order of the captures unless
you are using some sort of named parameter system for
them:
my $uri = $c->uri_for(
$c->controller->action_for('list'),
$c->request->query_parameters
);
my @captures = ();
foreach my $capture ( @{$c->request->captures} )
{
last if $uri;
push @captures, $capture;
$uri = $c->uri_for(
$c->controller->action_for('list'),
[EMAIL PROTECTED],
$c->request->query_parameters
);
}
As you can see it far from elegant. Basically it
takes advantage of the fact that $c->uri_for will
always return false if it can't make a uri and just
walks through your current capture list.
I could probably rewrite this more cleanly, but it was
the best I could come up with on a friday late
afternoon :)
--john
Evil yes, but it looks like it works better than anything we have
currently ;)
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/