Re: [Catalyst] Making subrequests in views

2008-11-25 Thread Alexander Tamm


Len Jaffe wrote:

> 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.

Yes, I remember that. It still doesn't address my concern that, in order
to avoid fetching unnecessary data, I have to take a peek inside the
template or maintain a list of exception

> 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.

It really doesn't matter when *cronologically*, only when *logically*,
ie. when needed.

Alex

-- 
Alexander Tamm
Software developer, Frantic media
[EMAIL PROTECTED]

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Making subrequests in views

2008-11-25 Thread Len Jaffe
On Mon, Nov 24, 2008 at 3:20 PM, Alexander Tamm <[EMAIL PROTECTED]> 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 or
>> 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.

Len.
-- 
[EMAIL PROTECTED]   - 614-404-4214
___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Making subrequests in views

2008-11-24 Thread Alexander Tamm

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 or 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. Since the two aren't necessarily maintained by the
same person, the solution is suboptimal. Nor am I keen on maintaining
some sort of "list of pages containing a navi portion".

Alex


___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


Re: [Catalyst] Making subrequests in views

2008-11-23 Thread Andrew Rodland
On Sunday 23 November 2008 03:29:11 am Alexander Tamm wrote:
> Hi,
>
> I'm pretty new to Catalyst and new to this mailing list. In other words,
> my apologies if this question has been frequently answered or if I've
> missed the relevant documentation.
>
> My basic setup is a Catalyst application running under FastCGI, using
> View::Mason for my views. I need to include a navigation component in
> most - not all - views, so I'm thinking about what strategy I should use
> to populate the stash with the correct data. As I see it, I have at
> least three options, but I'm not sure how smart they are.
>
> 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 or 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).

Andrew

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/


[Catalyst] Making subrequests in views

2008-11-23 Thread Alexander Tamm

Hi,

I'm pretty new to Catalyst and new to this mailing list. In other words, 
my apologies if this question has been frequently answered or if I've 
missed the relevant documentation.


My basic setup is a Catalyst application running under FastCGI, using 
View::Mason for my views. I need to include a navigation component in 
most - not all - views, so I'm thinking about what strategy I should use 
to populate the stash with the correct data. As I see it, I have at 
least three options, but I'm not sure how smart they are.


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.


2) Calling $c->forward( '/navi' ) in my navi view

3) Using Catalyst::Plugin::Subrequest and doing a subrequest-call from 
the view that needs to include the navi component.


Are these all equeally smart/stupid, or is there a best practice for this?

Thanks in advance,
Alex

___
List: Catalyst@lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/