stas 2004/07/03 18:41:49 Modified: src/docs/2.0/api/Apache Const.pod src/docs/2.0/api/APR Const.pod src/docs/2.0/api/ModPerl Const.pod Log: add explanations about *::Const modules Revision Changes Path 1.13 +70 -0 modperl-docs/src/docs/2.0/api/Apache/Const.pod Index: Const.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/Apache/Const.pod,v retrieving revision 1.12 retrieving revision 1.13 diff -u -u -r1.12 -r1.13 --- Const.pod 2 Jun 2004 19:09:52 -0000 1.12 +++ Const.pod 4 Jul 2004 01:41:49 -0000 1.13 @@ -2,9 +2,79 @@ Apache::Const - Perl Interface for Apache Constants + + + + =head1 Synopsis + # make the constants available but don't import them use Apache::Const -compile => qw(constant names ...); + + # w/o the => syntax sugar + use Apache::Const ("-compile", qw(constant names ...)); + + # compile and import the constants + use Apache::Const qw(constant names ...); + + + + + +=head1 Description + +This package contains constants specific to C<Apache> features. + +mod_perl 2.0 comes with several hundreds of constants, which you don't +want to make available to your Perl code by default, due to CPU and +memory overhead. Therefore when you want to use a certain constant you +need to explicitly ask to make it available. + +For example, the code: + + use Apache::Const -compile => qw(FORBIDDEN OK); + +makes the constants C<Apache::FORBIDDEN> and C<Apache::OK> available +to your code, but they aren't imported. In which case you need to use +a fully qualified constants, as in: + + return Apache::OK; + +If you drop the argument C<-compile> and write: + + use Apache::Const qw(FORBIDDEN OK); + +Then both constants are imported into your code's namespace and can be +used standalone like so: + + return OK; + +Both, due to the extra memory requirement, when importing symbols, and +since there are constants in other namespaces (e.g., +C<L<APR::|docs::2.0::api::APR::Const>> and +C<L<ModPerl::|docs::2.0::api::ModPerl::Const>>, and non-mod_perl +modules) which may contain the same names, it's not recommended to +import constants. I.e. you want to use the C<-compile> construct. + +Finaly, in Perl C<=E<gt>> is almost the same as the comma operator. It +can be used as syntax sugar making it more clear when there is a +key-value relation between two arguments, and also it automatically +parses its lefthand argument (the key) as a string, so you don't need +to quote it. + +If you don't want to use that syntax, instead of writing: + + use Apache::Const -compile => qw(FORBIDDEN OK); + +you could write: + + use Apache::Const "-compile", qw(FORBIDDEN OK); + +and for parentheses-lovers: + + use Apache::Const ("-compile", qw(FORBIDDEN OK)); + + =head1 Constants 1.21 +31 -0 modperl-docs/src/docs/2.0/api/APR/Const.pod Index: Const.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/APR/Const.pod,v retrieving revision 1.20 retrieving revision 1.21 diff -u -u -r1.20 -r1.21 --- Const.pod 2 Jun 2004 19:09:52 -0000 1.20 +++ Const.pod 4 Jul 2004 01:41:49 -0000 1.21 @@ -2,9 +2,40 @@ APR::Const - Perl Interface for APR Constants + + + + + =head1 Synopsis + # make the constants available but don't import them use APR::Const -compile => qw(constant names ...); + + # w/o the => syntax sugar + use APR::Const ("-compile", qw(constant names ...)); + + # compile and import the constants + use APR::Const qw(constant names ...); + + + + + + + +=head1 Description + +This package contains constants specific to C<APR> features. + +Refer to C<L<the Apache::Const description +section|docs::2.0::api::Apache::Const/Description>> for more +information. + + + + + =head1 Constants 1.3 +29 -0 modperl-docs/src/docs/2.0/api/ModPerl/Const.pod Index: Const.pod =================================================================== RCS file: /home/cvs/modperl-docs/src/docs/2.0/api/ModPerl/Const.pod,v retrieving revision 1.2 retrieving revision 1.3 diff -u -u -r1.2 -r1.3 --- Const.pod 22 May 2004 02:03:28 -0000 1.2 +++ Const.pod 4 Jul 2004 01:41:49 -0000 1.3 @@ -2,9 +2,38 @@ ModPerl::Const -- ModPerl Constants + + + + =head1 Synopsis + # make the constants available but don't import them use ModPerl::Const -compile => qw(constant names ...); + + # w/o the => syntax sugar + use ModPerl::Const ("-compile", qw(constant names ...)); + + # compile and import the constants + use ModPerl::Const qw(constant names ...); + + + + + + +=head1 Description + +This package contains constants specific to mod_perl features. + +Refer to C<L<the Apache::Const description +section|docs::2.0::api::Apache::Const/Description>> for more +information. + + + + + =head1 Constants
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]