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

Re: Apache2 namespace

Expand Messages
  • Jim Albert
    ... Yes, it does. Thank you very much. Do you have any example code you could share with me for places in my code where I have to use an Apache:: module on
    Message 1 of 9 , Jul 3, 2005
    • 0 Attachment
      Philip M. Gollucci wrote:
      > Jim Albert wrote:
      >
      >> Can someone point me to a URL that describes the purpose of the
      >> Apache2 namespace?
      >
      >
      > I don't believe one exists (yet) ... possibly a good idea for the
      > perl.apache.org site?
      >
      > The general idea as I've got it is:
      >
      > 1. Apache::*
      > Module works under mp1
      > Possibly works under mp2
      >
      > Example: Apache::DBI v0.98 (both)
      >
      > Example: Apache::Peek (mp1)
      >
      > Note: I'm working on porting this one as we speak
      > to work under both.
      >
      > 2. Apache2::*
      > Module works under mp2 only
      > Example: Apache2::AuthNTLM
      >
      > The decision is basically left up to the individual maintainers at the
      > moment. The benefit of 1 is that you have 1 code base. The benefit of
      > 2 is that you remove the if/else logic and clearly mark the module as
      > mp2 only.
      >
      > HTH

      Yes, it does. Thank you very much. Do you have any example code you
      could share with me for places in my code where I have to use an
      Apache:: module on some servers, but Apache2:: module on another. I'd
      like to keep one code base.

      For example, one piece of my code has
      use Apache::Const
      but I had to change that to use Apache2::Const on the server running the
      lastest mod_perl.

      Can you give me the logic to handle that properly in a single code file.
      Thanks again.

      --
      Jim Albert
    • J Matisse Enzer
      ... I think your key here is the MOD_PERL_API_VERSION environment variable. BEGIN { if ( $ENV{MOD_PERL_API_VERSION} == 2 ) { # do mp2 stuff } } ... Matisse
      Message 2 of 9 , Jul 3, 2005
      • 0 Attachment
        On Jul 3, 2005, at 2:10 PM, Jim Albert wrote:
        > Can you give me the logic to handle that properly in a single code
        > file. Thanks again.
        >

        I think your key here is the MOD_PERL_API_VERSION environment variable.

        BEGIN {
        if ( $ENV{MOD_PERL_API_VERSION} == 2 ) {
        # do mp2 stuff
        }
        }
        -------------------------------------------------------
        Matisse Enzer <matisse@...>
        http://www.matisse.net/ - http://www.eigenstate.net/
        415-225-6703 (work/cellphone)
        415-401-8325 (home)
      • Philip M. Gollucci
        ... Thats a start. The first to come to mind is Apache::DBI v 0.98 available here: http://p6m7g8.net/Apache-DBI/Apache-DBI-0.98.tar.gz AuthDBI.pm will give an
        Message 3 of 9 , Jul 3, 2005
        • 0 Attachment
          Jim Albert wrote:
          > For example, one piece of my code has
          > use Apache::Const
          > but I had to change that to use Apache2::Const on the server running the
          > lastest mod_perl.
          >
          > Can you give me the logic to handle that properly in a single code file.
          > Thanks again.

          >>I think your key here is the MOD_PERL_API_VERSION environment >variable.
          >>
          >>BEGIN {
          >> if ( $ENV{MOD_PERL_API_VERSION} == 2 ) {
          >> # do mp2 stuff
          >> }
          >>}
          Thats a start.

          The first to come to mind is
          Apache::DBI v 0.98 available here:

          http://p6m7g8.net/Apache-DBI/Apache-DBI-0.98.tar.gz

          AuthDBI.pm will give an a decent example.

          After looking at it again,

          BEGIN {
          if (MP2) {
          require Apache2::Const;
          Apache2::Const->import(-compile => qw(OK DECLINED));
          }
          else {
          require Apache::Constants;
          Apache::Constants->import(qw(OK DECLINED));
          }
          }

          Should probably be: [I'll have to test it a little later]

          BEGIN {
          if (MP2) {
          require Apache2::Const;
          Apache2::Const->import(qw(OK DECLINED));
          }
          else {
          require Apache::Constants;
          Apache::Constants->import(qw(OK DECLINED));
          }
          }

          you might also want to checkout:
          http://perl.apache.org/docs/2.0/rename.html


          --
          END
          ------------------------------------------------------------
          What doesn't kill us can only make us stronger.
          Nothing is impossible.

          Philip M. Gollucci (pgollucci@...) 301.254.5198
          Consultant / http://p6m7g8.net/Resume/resume.shtml
          Senior Developer / Liquidity Services, Inc.
          http://www.liquidityservicesinc.com
        • Philip M. Gollucci
          ... Here s the link I was looking for: Superseeds previous e-mail:
          Message 4 of 9 , Jul 3, 2005
          • 0 Attachment
            Philip M. Gollucci wrote:
            > Jim Albert wrote:
            >
            >> For example, one piece of my code has
            >> use Apache::Const
            >> but I had to change that to use Apache2::Const on the server running
            >> the lastest mod_perl.
            >>
            >> Can you give me the logic to handle that properly in a single code
            >> file. Thanks again.
            Here's the link I was looking for:

            Superseeds previous e-mail:
            http://perl.apache.org/docs/2.0/user/porting/compat.html#mod_perl_1_0_and_2_0_Constants_Coexistence

            --
            END
            ------------------------------------------------------------
            What doesn't kill us can only make us stronger.
            Nothing is impossible.

            Philip M. Gollucci (pgollucci@...) 301.254.5198
            Consultant / http://p6m7g8.net/Resume/resume.shtml
            Senior Developer / Liquidity Services, Inc.
            http://www.liquidityservicesinc.com
          • Jim Albert
            ... Hmmm.... seems like the example on that page relies on use mod_perl; to get $mod_perl::VERSION However, mod_perl.pm has changed to mod_perl2.pm in the
            Message 5 of 9 , Jul 5, 2005
            • 0 Attachment
              Philip M. Gollucci wrote:

              > Philip M. Gollucci wrote:
              >
              >> Jim Albert wrote:
              >>
              >>> For example, one piece of my code has
              >>> use Apache::Const
              >>> but I had to change that to use Apache2::Const on the server running
              >>> the lastest mod_perl.
              >>>
              >>> Can you give me the logic to handle that properly in a single code
              >>> file. Thanks again.
              >
              > Here's the link I was looking for:
              >
              > Superseeds previous e-mail:
              > http://perl.apache.org/docs/2.0/user/porting/compat.html#mod_perl_1_0_and_2_0_Constants_Coexistence

              Hmmm.... seems like the example on that page relies on
              use mod_perl;
              to get $mod_perl::VERSION
              However, mod_perl.pm has changed to mod_perl2.pm in the newer version of
              mod_perl that's now on my system, so it doesn't appear that the example
              at
              http://perl.apache.org/docs/2.0/user/porting/compat.html#mod_perl_1_0_and_2_0_Constants_Coexistence
              solves this particular problem.

              --
              Jim Albert
            • Philip M. Gollucci
              Hmmm.... seems like the example on that page relies on ... s/mod_perl/mod_perl2/g I ll see about updating this page _very_ shortly. -- END ... What doesn t
              Message 6 of 9 , Jul 5, 2005
              • 0 Attachment
                Hmmm.... seems like the example on that page relies on

                > use mod_perl;
                > to get $mod_perl::VERSION
                > However, mod_perl.pm has changed to mod_perl2.pm in the newer version
                > of mod_perl that's now on my system, so it doesn't appear that the
                > example at
                > http://perl.apache.org/docs/2.0/user/porting/compat.html#mod_perl_1_0_and_2_0_Constants_Coexistence
                > solves this particular problem.
                >
                s/mod_perl/mod_perl2/g

                I'll see about updating this page _very_ shortly.


                --
                END
                ---------------------------------------------------------
                What doesn't kill us can only make us stronger.
                Nothing is impossible.

                Philip M. Gollucci (pgollucci@...) 301.254.5198
                Consultant / http://p6m7g8.net/Resume/resume.shtml
                Senior Developer / Liquidity Services, Inc.
                http://www.liquidityservicesinc.com
                http://www.liquidation.com
                http://www.uksurplus.com
                http://www.govliquidation.com
                http://www.gowholesale.com
              • Jim Albert
                ... Correct, that will change mod_perl to mod_perl2 in my source, but my point was that it won t help in the case of attempting to maintain one code base (my
                Message 7 of 9 , Jul 5, 2005
                • 0 Attachment
                  Philip M. Gollucci wrote:

                  > Hmmm.... seems like the example on that page relies on
                  >
                  >> use mod_perl;
                  >> to get $mod_perl::VERSION
                  >> However, mod_perl.pm has changed to mod_perl2.pm in the newer version
                  >> of mod_perl that's now on my system, so it doesn't appear that the
                  >> example at
                  >> http://perl.apache.org/docs/2.0/user/porting/compat.html#mod_perl_1_0_and_2_0_Constants_Coexistence
                  >> solves this particular problem.
                  >>
                  > s/mod_perl/mod_perl2/g

                  Correct, that will change mod_perl to mod_perl2 in my source, but my
                  point was that it won't help in the case of attempting to maintain one
                  code base (my code) in terms of whether to include modules from the
                  Apache:: or Apache2:: namespace. Perhaps the exsitence of and the
                  particular value of $ENV{MOD_PERL_API_VERSION} might be better suited.

                  --
                  Jim Albert
                Your message has been successfully submitted and would be delivered to recipients shortly.