in reply to Maypole::CLI works, but Apache says 404
I managed to break the working BeerDB example by preloading my Maypole application class. If seems to work better if the class is loaded in each thread at first invocation. This works for setting the correct include lib with a PerlRequire in the httpd.conf:
use File::Basename; use lib dirname(__FILE__); #use BeerDB; 1; __END__
If I don't pre-load it, there is no output in the error log for warnings. Maybe this is the way Apache2 with threads is supposed to work. Maybe the threads in Apache2 + mod_perl 2 isn't very compatible yet. Maybe it's the usual caveats that go with using Perl threads. It make sense to have each thread keep it's own set of objects for everything, as similar to forking as possible.
If this still would turn out to not work, it would be a bit of a downer becuase the nice promise of Apache2 was that it would work fine on Windows. It's not that I'd want to deploy it on Windows, but for development it would be convenient.
Anyway, this messed up a lot of things, but I could not see at all what was wrong because I got the bogus 404 message.
Why no error message:
The root cause is that the TT process() doesn't work in my setup for some reason that broke with the threads thing (beer/list not found), and there is no way to see this, anywhere.
Lots of debug output pinpointed this to the fact that View::Maypole::Base::error() thinks there can't be a template error if there are no $r->{objects}.
# This is a rough test to see whether or not we're a template +or # a static page return -1 unless @{ $r->{objects} || [] };
I'm not sure what's supposed to happen to not get a 404 if there are no objects, but that's what I get now. A 500 Internal Server Error would seem to be more appropriate, although perhaps uglier.
/J
|
|---|