[Catalyst] Making subrequests in views
lenjaffe at jaffesystems.com
Tue Nov 25 23:43:13 GMT 2008
On Mon, Nov 24, 2008 at 3:20 PM, Alexander Tamm <alex at frantic.com> wrote:
> Andrew Rodland wrote:
>> On Sunday 23 November 2008 03:29:11 am Alexander Tamm wrote:
> 1) I could always populate the stash in auto() and call the
>>> corresponding Mason component when needed. This means fetching some data
>>> even if it isn't needed.
> This version, except that instead of doing it in auto, you do it in end =
>> in an ActionClass, only when you know you're going to need it (that is,
>> you're actually sending back a page that includes the menu, and not a
>> redirect or a downloadable file or whatever else).
> Do you have a rationale behind this suggestion? I'm not very keen on
> this one, since a change in the presentation logic can require a change
> in the controller.
The suggestion was for you populate the stash near the end of the request,
before calling out to your view, so as to avoid doing the work when it is
not necessary. That's why he suggested an ActionClass, or the end method.
Remember, the view is typically called from within the end() action, or form
an ActionClass like RenderView, which itself runs during the "lifecycle" of
the end() action.
lenjaffe at jaffesystems.com - 614-404-4214
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Catalyst