[Catalyst] Per request data in controller base class
Peter Karman
peter at peknet.com
Wed Nov 24 04:31:42 GMT 2010
Bill Moseley wrote on 11/23/10 8:12 PM:
> Now, controllers can be chained together, so for example I might have a
> chain /cd/*/track/*/movement/* which all use the same base class, and
> where in the "movement" action I might want to be able to fetch the cd
> and track objects fetched when processing the chain. So,
> $c->stash->{item} isn't such a good name.
>
> One option might be for the base class to use its class name as a
> namespace in the stash. That is, $c->stash->{CD}->{item} and
> $c->stash->{Track}->{item};
>
Controllers may be chained together, but the URI that triggers the dispatched
action represents a unique item. I.e., the URI may describe a movement in
relationship to its parent track and its parent CD, but the URI describes the
*movement*.
But that might just be philosophical neither-nor-there.
In general, I find name-spacing the stash a useful exercise, esp when dealing
with multiple developers using the stash as they work on different parts of a
single dispatch chain.
--
Peter Karman . http://peknet.com/ . peter at peknet.com
More information about the Catalyst
mailing list