You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs-cvs@perl.apache.org by st...@apache.org on 2003/07/25 10:56:33 UTC
cvs commit: modperl-docs/src/docs/2.0/user/porting compat.pod
stas 2003/07/25 01:56:33
Modified: src/docs/2.0/user/porting compat.pod
Log:
more on constants
Revision Changes Path
1.12 +25 -0 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.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- compat.pod 10 Jun 2003 01:11:25 -0000 1.11
+++ compat.pod 25 Jul 2003 08:56:33 -0000 1.12
@@ -265,8 +265,13 @@
following technique can be used for using constants:
package MyApache::Foo;
+
+ use strict;
+ use warnings;
+
use mod_perl;
use constant MP2 => $mod_perl::VERSION >= 1.99;
+
BEGIN {
if (MP2) {
require Apache::Const;
@@ -284,7 +289,27 @@
}
1;
+Notice that if you don't use the idiom:
+
+ return MP2 ? Apache::OK : Apache::Constants::OK;
+
+but something like the following:
+
+ sub handler1 {
+ ...
+ return Apache::Constants::OK();
+ }
+ sub handler2 {
+ ...
+ return Apache::OK();
+ }
+
+You need to add C<()>. If you don't do that, let's say that you run
+under mod_perl 2.0, perl will complain about mod_perl 1.0 constant:
+
+ Bareword "Apache::Constants::OK" not allowed while "strict subs" ...
+Adding C<()> prevents this warning.
=head2 Deprecated Constants
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-cvs-unsubscribe@perl.apache.org
For additional commands, e-mail: docs-cvs-help@perl.apache.org