memnoch has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks,

I'm wondering if there is any way to get all of the effects from:

Apache::exit(Apache::Constants::REDIRECT);

but without logging an error in the Apache error log. Any ideas?

Replies are listed 'Best First'.
Re: Apache::exit question
by pjotrik (Friar) on Jul 21, 2008 at 14:27 UTC
    I'm not sure about mod_perl 1 (which you seem to use), but in mod_perl2 you don't call exit when redirecting, you simply return Apache2::Const::REDIRECT from the handler method.
      Thanks and yes, we're using mod_perl 1. In my situation, it's not merely a redirect. The code is supposed to redirect back to the login page after some very defined login problems...so I also need to be able to abort the login prior to the redirect. (If I use a return, the login isn't aborted.) Right now, the code handles the flow exactly the way we want, except for the error in the log, which we don't want to see.
        Can you explain "If I use a return, the login isn't aborted" a bit more? What are you trying to avoid? A custom log handler that does something if the person is logged in? I think there must be a more elegant solution than calling Apache::exit().