Geoffrey Young wrote:


Christian Laursen wrote:

I have a small problem with Apache::compat.

I have got some mp1 code running under mp2 using Apache::compat,
but I had to change it a little bit in order to do that.

A few places we have the following:

use Apache::Constants qw(:common :response);

It looks like the response group is missing in Apache::Constants
when running under mp2 with Apache::compat as we get this error:
[...]
nope, you're right - Apache::compat just passes whatever import tags you specify to Apache::Const, and there's no :response tag in mp2.

the only real reason I've ever seen anyone use :response is for REDIRECT, which now exists in :common, so I suspect that's why your code worked.

anyway, try this patch (against current CVS - I'm not sure if there have been changes since the last release) which weeds out attempts to import non-existent tags.

[...]


Index: lib/Apache/compat.pm
===================================================================
RCS file: /home/cvspublic/modperl-2.0/lib/Apache/compat.pm,v
retrieving revision 1.88
diff -u -r1.88 compat.pm
--- lib/Apache/compat.pm        30 Aug 2003 02:33:26 -0000      1.88
+++ lib/Apache/compat.pm        21 Oct 2003 13:00:07 -0000
@@ -148,7 +148,11 @@
 sub import {
     my $class = shift;
     my $package = scalar caller;
-    Apache::Const->compile($package => @_);
+
+    # skip over import tags that don't exist in mp2
+    my @args = grep { !/:response|:server|:args_how/ } @_;
+
+    Apache::Const->compile($package => @args);
 }

But this patch simply ignores the 3 passed groups. Shouldn't it push :common instead?


  my @args = grep { !/:response|:server|:args_how/ } @_;
  push @args, ":common" if @_ != @args;

If someone used:

use Apache::Constants qw(:response);

your patch won't make the code working, besides suppressing the import error.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Reply via email to