[Catalyst-dev] Please Review Tutorial Changes For RenderView

Marcus Ramberg marcus.ramberg at gmail.com
Wed Jul 5 08:52:16 CEST 2006


On 7/5/06, hkclark at gmail.com <hkclark at gmail.com> wrote:
>
> >
> > Would it be a good idea to have the helper for Root.pm put in the
> > commend for the end action so that it's already using RenderView?
> >
> > Kennedy
> >
>
> Two update:
>
> 1) I have not heard back from anyone on this... my guess is if we ship
> 5.7000 with the tutorial "as is" we will regret it :-)   If there is
> anyone familiar with RenderView out there, please review my changes.


Sorry, I've been kinda busy with my bathroom and stuff, back now.

2) Re my previous note about the helper: it looks like I'm using an
> old version of Catalyst::Helper -- it looks like the version in trunk
> does what I was talking about.


Yeah. I am kinda worried that catalyst.pl does not in fact detect that
people have an old Catalyst::Helper, and thus won't be notified about
needing to install the Catalyst-Devel package :(

3) After playing with RenderView a little more, I'm guessing that the
> "sub end : ActionClass('RenderView')" should NOT include the
> "$c->forward('MyApp::View::TT') unless $c->res->body;" line as I show
> in the links to the stuff I submitted to subversion earlier today.  If
> I leave that line in, it pukes with a "Coldn't render template "file
> error - books/list: not found"" error message.


Right, as done by the default helper, your renderview line should look like
this:

sub end : ActionClass('RenderView') {}

and you can extend it like this:

sub end : ActionClass('RenderView') {
   my ($self,$c) = @_;
   .... # do stuff here
}
Where the view will be rendered according to the same logic as DefaultEnd
after the do stuff here bit. If you need to do stuff after rendering the
view, you should do something like this:

sub render : ActionClass('RenderView') {}

sub end : Private {
    my ($self,$c) = @_;
    $c->forward('render');
    ... # do stuff here
}


Hope this clears up some of your worries.


Thanks,
> Kennedy
>
> PS -- Looks like there is a typo in the "Coldn't render..." -- might
> be worth fixing for 5.7000.
>
> _______________________________________________
> Catalyst-dev mailing list
> Catalyst-dev at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst-dev
>



-- 
With regards
Marcus Ramberg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst-dev/attachments/20060705/400e2a20/attachment-0001.htm 


More information about the Catalyst-dev mailing list