I just had this request:
http://cpepc210-3/cgi-bin/beerfb.cgi/test
give me this response:
Server error!
The server encountered an internal error and was unable to
complete your request.
Error message:
Premature end of script headers: beerfb.cgi
If you think this is a server error, please contact the webmaster.
Error 500
Worryingly, there's nothing at all in my apache error log!
'test.tt' is a small test template I was just setting up to investigate
something else. It just said [% PROCESS header %] which failed because
it should have said [% PROCESS header.tt %] If I run the URL through
Maypole::CLI, I can see the actual error that was produced:
file error - header: not found at
/usr/lib/perl5/site_perl/5.8.6/Maypole.pm line 123
but the production environment is swallowing the error message. I think
Maypole::View::Base::error is out of step with Maypole::handler_guts.
I'm confused by the bit I've marked with >:
sub error {
my ( $self, $r, $desc ) = @_;
$desc = $desc ? "$desc: " : "";
carp $desc . $r->{error};
if ( $r->{error} =~ /not found$/ ) {
> # This is a rough test to see whether or not we're a template or
> # a static page
> return -1 unless @{ $r->{objects} || [] };
my $template_error = $r->{error};
Think about that in the context of the environment in which it's called
(Maypole::handler_guts). The context has changed quite a lot since that
line was written, I believe:
if ( !$r->{output} ) { # You might want to do it yourself
eval { $status = $r->view_object->process($r) };
if ( my $error = $@ ) {
$status = $r->call_exception($error);
if ( $status != OK ) {
warn "caught view error: $error" if $r->debug;
return $r->debug ? $r->view_object->error( $r, $error )
: ERROR;
}
}
return $status;
}
else { return OK; }
What's confusing me? Well first, the comment - it's ALWAYS a template
isn't it? Never a static page. I think it checks for a template with
some data from the database as opposed to a template without. Which is
pretty crazy.
So I think because $@ isn't set to anything, the view error message is
never examined and handler_guts just gives up.
I can't see any reason not to just delete that 'rough test'. It doesn't
seem to do anything useful. And if it isn't there, I expect I'd get the
nice page explaining there were problems finding a template. But my
brain hurts, so I'd be grateful for any other thoughts.
Cheers, Dave
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Maypole-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-devel