stas        2003/06/09 18:11:25

  Modified:    src/docs/2.0/user/porting compat.pod
  Log:
  new section: mod_perl 1.0 and 2.0 Constants Coexistence
  
  Revision  Changes    Path
  1.11      +28 -1     modperl-docs/src/docs/2.0/user/porting/compat.pod
  
  Index: compat.pod
  ===================================================================
  RCS file: /home/cvs/modperl-docs/src/docs/2.0/user/porting/compat.pod,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- compat.pod        6 Jun 2003 05:52:19 -0000       1.10
  +++ compat.pod        10 Jun 2003 01:11:25 -0000      1.11
  @@ -253,11 +253,38 @@
   =back
   
   See the manpages of the respective modules to figure out which
  -constants they provide. (XXX: not all manpages exist yet.)
  +constants they provide.
   
   META: add the info how to perform the transition. XXX: may be write a
   script, which can tell you how to port the constants to 2.0? Currently
   C<Apache::compat> doesn't provide a complete back compatibility layer.
  +
  +=head2 mod_perl 1.0 and 2.0 Constants Coexistence
  +
  +If the same codebase is used for both mod_perl generations, the
  +following technique can be used for using constants:
  +
  +  package MyApache::Foo;
  +  use mod_perl;
  +  use constant MP2 => $mod_perl::VERSION >= 1.99;
  +  BEGIN {
  +      if (MP2) {
  +          require Apache::Const;
  +          Apache::Const->import(-compile => qw(OK DECLINED));
  +      }
  +      else {
  +          require Apache::Constants;
  +          Apache::Constants->import(qw(OK DECLINED));
  +      }
  +  }
  +  
  +  sub handler {
  +      # ...
  +      return MP2 ? Apache::OK : Apache::Constants::OK;
  +  }
  +  1;
  +
  +
   
   =head2 Deprecated Constants
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to