You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ole Kasper Olsen <ol...@opera.com> on 2006/02/17 14:04:21 UTC

Properly returning from ModPerl::Registry -run scripts

Hi,

I have quite a lot of scripts which are run through mod_perl on Apache2
with the ModPerl::Registry module.

In many cases, I want to return status codes different from
Apache2::Const::OK when the scripts ends, for example a
Apache2::Const::REDIRECT in case of the script redirecting the user to
another script.

Currently this is done by

    $r->err_headers_out("Location" => "new url");
    $r->status(Apache2::Const::REDIRECT);
    exit();

and I was simply wondering if forcefully setting the status this way is
the best way to do it. It would be cool if I could somehow (in a simple
and efficient manner) make the handler created by (or should that be
"which is"?) ModPerl::Registry return the value properly, as is customary
when creating proper handlers, i.e.:

    sub handler {
      my $r = shift;
      $r->err_headers_out("Location" => "new url");
      return Apache2::Const::REDIRECT;
    }


-- 
Ole Kasper Olsen
Information Systems Developer
Opera Software ASA