Hi Francisco,
Sorry it took a long time to reply. Been to Spain.
On Fri, 13 Sep 2002, Francisco Corella wrote:
> I believe calling Apache::exit doesn't prevent the log phase from
> being run for the request, does it?
That's the way I understand it.
> You recommend using 'return' rather than 'exit', but that's easier said than
> done. I'm using Apache::Registry and I'm reusing code that was originally
> part of CGI scripts. You can't just change 'exit' to 'return' if 'exit' is
> buried under many levels of procedure calls.
I don't think I quite did that, I meant that you can return a value
from a mod_perl script to Apache to tell it what you want. If you're
using Apache::Registry you can use the $r->status method to return the
value, for example
$r->status(NOT_FOUND);
before exiting your Registry script.
Apache::Registry attempts to simulate a CGI environment. If your code
is reasonably well-formed then you shouldn't have to make a lot of
changes. I think most CGI scripts will work under Apache::registry,
or can be made to work by relatively painless modifications.
> And one is not supposed to call return in a script handled by
> Apache::Registry, am I right?
I'm sure you can, but I think Apache::Registry will ignore it and still
return OK to Apache unless you do something like $r->status(NOT_FOUND);
before you return.
> Even when I'm writing new code, I'd like to use Apache::exit as an
> exception-raising mechanism. (I believe Apache::Registry does an eval{}
> that catches the exception.) Is this a bad idea?
If you're writing new code then I would recommend writing handlers and
avoiding Apache::Registry altogether.
73,
Ged.