[TEEJAY - Mon Aug 22 14:19:54 2005]:
Show quoted text> [DAVEBAIRD - Fri Aug 12 06:46:22 2005]:
>
> > The send_output methods in the frontend classes should return a
> status
> > code, and Maypole::handler() should return that code, rather than
> > assuming that the code has not changed from OK during send_output().
>
>
> Can we have a bit more detail of which module send_output is in, etc?
Maypole::handler() finishes like this:
my $status = $r->handler_guts();
return $status unless $status == OK;
$r->send_output;
return $status;
send_output is defined in the particular frontend - CGI::Maypole,
Apache::MVC, MasonX::Maypole, Maypole::CLI. The first 2 print their
output, but don't check for an error from the print method, and
implicitly return the return value of the print call. These send_output
methods are pretty straightforward and there's not much opportunity for
an error, but if there is one, it will not be caught.
MasonX::Maypole::send_output has to jump through a few more hoops, so is
more error prone. Also, templates run perl code, which is run during
send_output, so there's plenty of scope for errors. The final call is to
the Mason exec() method, which returns a HTTP status code i.e.
SERVER_ERROR if there's a syntax error in one of the templates. The
expectation is that the status code will be returned to the handler,
which will return it to the client. But the handler ignores it.
Show quoted text> If the solution is obvious can you apply a fix in SVN otherwise
> suggest
> a general plan here or on the list
The solution I think is that the frontends that don't want or need to
check for errors in send_output should return OK. Maypole::handler
should then return the rv from the send_output call:
my $status = $r->handler_guts();
return $status unless $status == OK;
return $r->send_output;
If that looks reasonable I can fix up the frontends.
d.