Mailing List Archive

svn commit: r372631 - in /perl/modperl/docs/trunk/src/docs/2.0/user: Changes.pod coding/coding.pod config/config.pod porting/compat.pod porting/porting.pod
Author: stas
Date: Thu Jan 26 14:15:29 2006
New Revision: 372631

URL: http://svn.apache.org/viewcvs?rev=372631&view=rev
Log:
get rid of the use of $mod_perl::VERSION in the 2.0 docs. use
$ENV{MOD_PERL_API_VERSION} instead
Submitted by: Frank Wiles <frank@wiles.org>

Modified:
perl/modperl/docs/trunk/src/docs/2.0/user/Changes.pod
perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod
perl/modperl/docs/trunk/src/docs/2.0/user/config/config.pod
perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod
perl/modperl/docs/trunk/src/docs/2.0/user/porting/porting.pod

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/Changes.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/Changes.pod?rev=372631&r1=372630&r2=372631&view=diff
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/Changes.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/Changes.pod Thu Jan 26 14:15:29 2006
@@ -11,6 +11,10 @@

=head1 ...

+Replaced the idiom of using $mod_perl::VERSION as a test for whether
+or not you're running under mod_perl 1.x or mod_perl 2.x with a more
+accurate and general test. By Frank Wiles E<lt>frankE<lt>atE<gt>wiles.orgE<gt>.
+
A new troubleshooting section on how to resolve can't locate file foo,
when there is a system limit on the maximum open files. By Ken Simpson
E<lt>ksimpsonE<lt>atE<gt>larch.mailchannels.comE<gt>.

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod?rev=372631&r1=372630&r2=372631&view=diff
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/coding/coding.pod Thu Jan 26 14:15:29 2006
@@ -142,7 +142,9 @@
following technique:

use mod_perl;
- use constant MP2 => ($mod_perl::VERSION >= 1.99);
+ use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
+ $ENV{MOD_PERL_API_VERSION} >= 2 );
+
# die "I want mod_perl 2.0!" unless MP2;

=back

Modified: perl/modperl/docs/trunk/src/docs/2.0/user/config/config.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/config/config.pod?rev=372631&r1=372630&r2=372631&view=diff
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/config/config.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/config/config.pod Thu Jan 26 14:15:29 2006
@@ -794,7 +794,7 @@

=item *

-C<MOD_PERL> (always)
+C<MOD_PERL> and C<MOD_PERL_API_VERSION> (always)

=item *


Modified: perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod?rev=372631&r1=372630&r2=372631&view=diff
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/porting/compat.pod Thu Jan 26 14:15:29 2006
@@ -352,7 +352,9 @@
use warnings;

use mod_perl;
- use constant MP2 => $mod_perl::VERSION >= 1.99;
+ use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
+ $ENV{MOD_PERL_API_VERSION} >= 2 );
+

BEGIN {
if (MP2) {
@@ -495,12 +497,11 @@
if ($ENV{MOD_PERL}) { ... }

To check for a specific version it's better to use
-C<$mod_perl::VERSION>:
+C<$ENV{MOD_PERL_API_VERSION}>

use mod_perl;
- use constant MP2 => ($mod_perl::VERSION >= 1.99);
-
-
+ use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
+ $ENV{MOD_PERL_API_VERSION} >= 2 );




Modified: perl/modperl/docs/trunk/src/docs/2.0/user/porting/porting.pod
URL: http://svn.apache.org/viewcvs/perl/modperl/docs/trunk/src/docs/2.0/user/porting/porting.pod?rev=372631&r1=372630&r2=372631&view=diff
==============================================================================
--- perl/modperl/docs/trunk/src/docs/2.0/user/porting/porting.pod (original)
+++ perl/modperl/docs/trunk/src/docs/2.0/user/porting/porting.pod Thu Jan 26 14:15:29 2006
@@ -1209,10 +1209,11 @@

To continue our example above, let's say we want to support opening a
filehandle in both mod_perl 2.0 and mod_perl 1.0. Our code can make
-use of the variable C<$mod_perl::VERSION>:
+use of the environment variable C<$ENV{MOD_PERL_API_VERSION}>

use mod_perl;
- use constant MP2 => ($mod_perl::VERSION >= 1.99);
+ use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
+ $ENV{MOD_PERL_API_VERSION} >= 2 );
# ...
require Symbol if MP2;
# ...
@@ -1220,25 +1221,14 @@
my $fh = MP2 ? Symbol::gensym : Apache->gensym;
open $fh, $file or die "Can't open $file: $!";

-Though, make sure that you don't use C<$mod_perl::VERSION> string
-anywhere in the code before you have declared your module's own
-C<$VERSION>, since PAUSE will pick the wrong version when you submit
-the module on CPAN. It requires that module's C<$VERSION> will be
-declared first. You can verify whether it'll pick the I<Foo.pm>'s
-version correctly, by running this code:
-
- % perl -MExtUtils::MakeMaker -le 'print MM->parse_version(shift)' Foo.pm
-
-There is more information about this issue here:
-http://pause.perl.org/pause/query?ACTION=pause_04about#conventions
-
Some modules, like C<CGI.pm> may work under mod_perl and without it,
and will want to use the mod_perl 1.0 API if that's available, or
mod_perl 2.0 API otherwise. So the following idiom could be used for
this purpose.

use constant MP_GEN => $ENV{MOD_PERL}
- ? eval { require mod_perl; $mod_perl::VERSION >= 1.99 ? 2 : 1 }
+ ? { ( exists $ENV{MOD_PERL_API_VERSION} and
+ $ENV{MOD_PERL_API_VERSION} >= 2 ) ? 2 : 1 }
: 0;

It sets the constant C<MP_GEN> to 0 if mod_perl is not available, to 1
@@ -1322,7 +1312,8 @@
use warnings;

use mod_perl;
- use constant MP2 => $mod_perl::VERSION < 1.99 ? 0 : 1;
+ use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
+ $ENV{MOD_PERL_API_VERSION >= 2 );

BEGIN {
if (MP2) {
@@ -1377,10 +1368,11 @@
use warnings;

use mod_perl;
- use constant MP2 => $mod_perl::VERSION < 1.99 ? 0 : 1;
+ use constant MP2 => ( exists $ENV{MOD_PERL_API_VERSION} and
+ $ENV{MOD_PERL_API_VERSION >= 2 );

BEGIN {
- warn "running $mod_perl::VERSION!\n";
+ warn "running $ENV{MOD_PERL_API_VERSION}\n";
if (MP2) {
require Apache2::RequestRec;
require Apache2::RequestIO;



---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org