$res->body question (was Re: [Catalyst] Extra characters inserted into PDF output

Jesse Sheidlower jester at panix.com
Sun Dec 21 23:54:04 GMT 2008


On Sun, Dec 21, 2008 at 08:12:29AM -0800, Dr. Jennifer Nussbaum wrote:
> > sub render : ActionClass('RenderView') { }
> > 
> > sub end : Private { 
> >   my ( $self, $c ) = @_;
> >   $c->forward('render');
> >   if ($c->res->body) {
> > $c->log->info("There is a body; returning");
> > return; }
> >   if (defined $c->stash->{edit_data} ) {
> >     $c->fillform( $c->stash->{edit_data} );
> >   } else {
> >     $c->fillform;
> >   }
> > }
> > 
> > When i try to edit a page, which just goes through the
> > usual Catalyst stuff, i find thta i still get a "There
> > is a body; returning" message in my debug log. That is
> > i get a body no matter what (here i am not generating a PDF
> > page, just a regular page through TT), and fillform never
> > runs. So i cant edit anything, it doesnt fill the form back
> > in from my database.
> > 
> > Is something in the wrong place? Why do i have a body here?
> 
> Never mind, i see that i just have to move the "return if $c->res->body"
> call to _before_ the render call. No need to ship to the view if theres already a body, so....
> 
> Sorry i should have tried this first.

Uh, is she right here?

When I changed the FillInForm docs I had it the way it was
first, with the call to RenderView first and then the "return
unless $c->res->body;". Is it OK if I just switch the order?

Jesse



More information about the Catalyst mailing list