[Catalyst] Returning values from forward()

J. Shirley jshirley at gmail.com
Fri Jun 8 20:45:08 GMT 2007


On 6/8/07, Jim Spath <jspath at pangeamedia.com> wrote:
>
> What is the consensus on returning values from a call to forward?
>
> I've seen a mailing list post stating that one should not rely on return
> values from forward():
>
> http://www.mail-archive.com/catalyst@lists.rawmode.org/msg03519.html
>
> But the Catalyst docs seem to indicate that returning values is allowed
> as long as you are aware of the the consequences:
>
>
> http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7007/lib/Catalyst.pm#=
$c-%3Eforward(_$action_[,_\@arguments_]_)
>
> Anyways, just wanted to get a sense of what people think.
>
> - Jim
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>


My personal opinion on it is to never use return values from ->forward.  If
you need the data, stick it in the stash.  I also find it very useful to
setup structured stash key definitions along with a glossary to keep things
sane.

For instance, if I'm holding onto any result sets in a chain, or forwards,
those always go to ->stash->{resultset}->{foo} (where foo is typically the
action name used to generate the resultset).

It's kept my applications extensible and pretty clean.

-Jay

-- =

J. Shirley :: jshirley at gmail.com :: Killing two stones with one bird...
http://www.toeat.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070608/d4533=
27b/attachment.htm


More information about the Catalyst mailing list