Loading ...
Sorry, an error occurred while loading the content.

$r->status() ?

Expand Messages
  • Helmut Zeilinger
    Hi all, i am confused about $r- status(). When do i have to set this manually - if ever? I searched for documentations about this item, but i did not find a
    Message 1 of 3 , May 1, 2004
    • 0 Attachment
      Hi all,

      i am confused about $r->status().
      When do i have to set this "manually" - if ever?
      I searched for documentations about this item, but i did not find a
      detailed explaination.

      My problem is, what's the difference between

      sub handler {
      ..
      $r->status(404);
      return (?);
      }

      and

      sub handler {
      ..
      return (HTTP_NOT_FOUND);
      }

      [? means that i don't know what to return]


      Regards

      Helmut

      --
      Report problems: http://perl.apache.org/bugs/
      Mail list info: http://perl.apache.org/maillist/modperl.html
      List etiquette: http://perl.apache.org/maillist/email-etiquette.html
    • Geoffrey Young
      ... you should never set $r- status from a handler. ... I ve explained it on this and the dev list a few times, so you should find discussions in the archives.
      Message 2 of 3 , May 1, 2004
      • 0 Attachment
        Helmut Zeilinger wrote:
        > Hi all,
        >
        > i am confused about $r->status().
        > When do i have to set this "manually" - if ever?

        you should never set $r->status from a handler.

        > I searched for documentations about this item, but i did not find a
        > detailed explaination.

        I've explained it on this and the dev list a few times, so you should find
        discussions in the archives. it's also in the mod_perl developer's cookbook.

        >
        > My problem is, what's the difference between
        >
        > sub handler {
        > ..
        > $r->status(404);
        > return (?);
        > }

        that idiom is used with Registry scripts and Registry scripts only. it's
        basically a hack that let's Registry scripts return something other than ok.
        note that Registry sets $r->handler back to whatever it was before you
        messed with it, and it is the only valid use of $r->status($foo).

        >
        > and
        >
        > sub handler {
        > ..
        > return (HTTP_NOT_FOUND);
        > }
        >
        > [? means that i don't know what to return]

        the return value of the handler is the status that gets set on the HTTP
        Response Line. $r->status is really an internal bookeeping variable for
        apache - most of the time it's the same as the response line status, but if
        you set it manually it will mess up any future error document cycles, since
        that's the marker that apache uses for keeping track of recursive errors
        (the "additionally, a 500 server error was encountered" foo).

        again, you can search the archives and MPDC for more details.

        HTH

        --Geoff

        --
        Report problems: http://perl.apache.org/bugs/
        Mail list info: http://perl.apache.org/maillist/modperl.html
        List etiquette: http://perl.apache.org/maillist/email-etiquette.html
      • Helmut Zeilinger
        Yes helped .. thanks a lot for explaining this again! Helmut --On Saturday, May 01, 2004 09:41:13 -0400 Geoffrey Young ... -- Report problems:
        Message 3 of 3 , May 2, 2004
        • 0 Attachment
          Yes helped .. thanks a lot for explaining this again!

          Helmut

          --On Saturday, May 01, 2004 09:41:13 -0400 Geoffrey Young
          <geoff@...> wrote:

          >
          >
          > Helmut Zeilinger wrote:
          >> Hi all,
          >>
          >> i am confused about $r->status().
          >> When do i have to set this "manually" - if ever?
          >
          > you should never set $r->status from a handler.
          >
          >> I searched for documentations about this item, but i did not find a
          >> detailed explaination.
          >
          > I've explained it on this and the dev list a few times, so you should find
          > discussions in the archives. it's also in the mod_perl developer's
          > cookbook.
          >
          >>
          >> My problem is, what's the difference between
          >>
          >> sub handler {
          >> ..
          >> $r->status(404);
          >> return (?);
          >> }
          >
          > that idiom is used with Registry scripts and Registry scripts only. it's
          > basically a hack that let's Registry scripts return something other than
          > ok. note that Registry sets $r->handler back to whatever it was before
          > you messed with it, and it is the only valid use of $r->status($foo).
          >
          >>
          >> and
          >>
          >> sub handler {
          >> ..
          >> return (HTTP_NOT_FOUND);
          >> }
          >>
          >> [? means that i don't know what to return]
          >
          > the return value of the handler is the status that gets set on the HTTP
          > Response Line. $r->status is really an internal bookeeping variable for
          > apache - most of the time it's the same as the response line status, but
          > if you set it manually it will mess up any future error document cycles,
          > since that's the marker that apache uses for keeping track of recursive
          > errors (the "additionally, a 500 server error was encountered" foo).
          >
          > again, you can search the archives and MPDC for more details.
          >
          > HTH
          >
          > --Geoff
          >


          --
          Report problems: http://perl.apache.org/bugs/
          Mail list info: http://perl.apache.org/maillist/modperl.html
          List etiquette: http://perl.apache.org/maillist/email-etiquette.html
        Your message has been successfully submitted and would be delivered to recipients shortly.