Re: [Catalyst] ActionClass('RenderView') questions

2013-03-10 Thread Tomas Doran

On 5 Mar 2013, at 14:46, E R pc88m...@gmail.com wrote:
 My use case is that I am developing a second view class, but it can't handle 
 all of the templates yet. So the logic I am putting into the end method is:
 
   if (View2 can handle template $c-stash-{template}) {
 $c-stash-{current_view} = 'View2';
   }
 
 This way I can incrementally test View2 as I add capabilities to it.

aha!

I'd handle this with a 3rd view, which just delegates to the 2nd view, then the 
1st if the newer view doesn't like it..

This separates the 'do I call a view at all' logic - which you're happy with 
Catalyst's handling of, from the 'which of my views do I delegate to from _this 
request_' handling - which needs to be your own logic..

Cheers
t0m


___
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] ActionClass('RenderView') questions

2013-03-05 Thread E R
On Mon, Mar 4, 2013 at 9:00 PM, Tomas Doran bobtf...@bobtfish.net wrote:


 On 4 Mar 2013, at 22:59, E R pc88m...@gmail.com wrote:
 
  Also, what does it mean if $c-stash-{template} is undef at this point?

 Maybe :)


My use case is that I am developing a second view class, but it can't
handle all of the templates yet. So the logic I am putting into the end
method is:

  if (View2 can handle template $c-stash-{template}) {
$c-stash-{current_view} = 'View2';
  }

This way I can incrementally test View2 as I add capabilities to it.

I need to know what it means when $c-stash-{template} is undef. If it is
only undef when there are redirects then I can safely ignore that case.
___
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] ActionClass('RenderView') questions

2013-03-05 Thread John Napiorkowski







 From: E R pc88m...@gmail.com
To: The elegant MVC web framework catalyst@lists.scsys.co.uk 
Sent: Tuesday, March 5, 2013 9:46 AM
Subject: Re: [Catalyst] ActionClass('RenderView') questions
 






On Mon, Mar 4, 2013 at 9:00 PM, Tomas Doran bobtf...@bobtfish.net wrote:


On 4 Mar 2013, at 22:59, E R pc88m...@gmail.com wrote:


 Also, what does it mean if $c-stash-{template} is undef at this point?

Maybe :)



My use case is that I am developing a second view class, but it can't handle 
all of the templates yet. So the logic I am putting into the end method is:


  if (View2 can handle template $c-stash-{template}) {
    $c-stash-{current_view} = 'View2';
  }


This way I can incrementally test View2 as I add capabilities to it.


I need to know what it means when $c-stash-{template} is undef. If it is 
only undef when there are redirects then I can safely ignore that case.the 
template stash var is a convention that informs the view (several views 
support it) what template to use, or to use the default behavior, whatever 
that happens to be.  For the TT view, if that stash var is not defined, it 
guesses a template based on the action name.

___
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/


___
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] ActionClass('RenderView') questions

2013-03-05 Thread E R
That answers my question - thanks!


On Tue, Mar 5, 2013 at 9:12 AM, John Napiorkowski jjn1...@yahoo.com wrote:




   --
 *From:* E R pc88m...@gmail.com
 *To:* The elegant MVC web framework catalyst@lists.scsys.co.uk
 *Sent:* Tuesday, March 5, 2013 9:46 AM
 *Subject:* Re: [Catalyst] ActionClass('RenderView') questions




 On Mon, Mar 4, 2013 at 9:00 PM, Tomas Doran bobtf...@bobtfish.net wrote:


 On 4 Mar 2013, at 22:59, E R pc88m...@gmail.com wrote:
 
  Also, what does it mean if $c-stash-{template} is undef at this point?

 Maybe :)


 My use case is that I am developing a second view class, but it can't
 handle all of the templates yet. So the logic I am putting into the end
 method is:

   if (View2 can handle template $c-stash-{template}) {
 $c-stash-{current_view} = 'View2';
   }

 This way I can incrementally test View2 as I add capabilities to it.

 I need to know what it means when $c-stash-{template} is undef. If it is
 only undef when there are redirects then I can safely ignore that case.

 the template stash var is a convention that informs the view (several
 views support it) what template to use, or to use the default behavior,
 whatever that happens to be.  For the TT view, if that stash var is not
 defined, it guesses a template based on the action name.

 ___
 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/



 ___
 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/


___
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] ActionClass('RenderView') questions

2013-03-04 Thread Tomas Doran

On 4 Mar 2013, at 22:59, E R pc88m...@gmail.com wrote:

 In my root controller, I have this method:
 
 sub end : ActionClass('RenderView') { ... }
 
 I understand that this method is called after the controller for the request 
 has finished and just before the view is called to render any output.
 
 My question is: in this 'end' method, how can I determine what the response 
 status is going to be (i.e. 200, 302, etc.),

As you will have set that already, so you can just call $c-res-status to 
retrieve it.

 and if the response is a redirect how can I get at the redirection location?

Again, you'll have set it already - i.e. it'll be retrievable from 
$c-res-headers if you need it.

What's the use-case here? Generally for a 200 you need to render a template, 
and for a 302 you don't want to (as there is no body), and the RenderView 
action class handles these default cases automagically.

This (generally) means that you don't need to get these values back - why do 
you think you need to / what are you trying to achieve?

 
 Also, what does it mean if $c-stash-{template} is undef at this point?

Maybe :)

You can explicitly set this, or you can let it default (in _some_ views) - it 
depends on your app.

Cheers
t0m


___
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/