[Catalyst] [Announce] Catalyst-Runtime 5.7099_01 - Developer Release

Charles Bailey bailey.charles at gmail.com
Thu Jun 26 23:50:58 BST 2008

On Wed, Jun 25, 2008 at 4:57 PM, Marcus Ramberg <marcus at nordaaker.com> wrote:
> The feature to note here is 'go', which works like an internal redispatch to
> another action, while retaining the stash intact. Being able to do this
> means that in practice you don't ever need to set the template name in
> stash, but can depend on using go when you want to render the template of
> the other action, rather than the one you dispatched to.

Would it make sense to include a function analogous to forward() (say,
"visit()") in the same way that go() is analogous to detach()?  Seems
like it'd be a nice way to "wrap" an action that uses auto() or end()
in its controller to handle tasks common to several actions there.

I've found myself in similar circumstances doing something like

sub test_wrapper : Local {
    my($self,$c) = @_;

    # Setup as needed
    $c->forward($target, 'auto');
    $c->forward($target, 'foo');
    $c->forward($target, 'end');
    $c->stash->{whatever} = $c->res->body;
    $c->stash->{template} = 'test/foowrapper.tt';
    $c->res->content_type('');  # Clear so View::TT will set it

and it'd be nice to have the first three calls handled by the
dispatcher, rather than having to know about $target's structure.

Charles Bailey
Lists: bailey _dot_ charles _at_ gmail _dot_ com
Other: bailey _at_ newman _dot_ upenn _dot_ edu

More information about the Catalyst mailing list