Of course, what I forgot to mention below - and sorry if you know that already - is that whichever perl modules you pre-load in your main Apache server config via the startup.pl script, you do not need to "use" anymore in all your perl scripts or Apache/mod_perl handlers. (At the cost of having them (insibly) duplicated in all the children processes). But it may simplify your migration problems, and you can always tune this later.

André

André Warnier wrote:

Hi.

About your problem below...

I am not sure that this is going to help, nor even if it is really relevant to your specific problem. Just trying to give you ideas, because it reminds me of something. Below are two configurations, of two of our systems which have slightly different versions of mod_perl and the rest. I went through the same kind of problems you're going through, a while ago when going from Apache 1.x to Apache 2.x, and then again more recently when there were some changes in the mod_perl naming of modules between mod_perl 1.9xx and mod_perl 2.0, and then some additional things happened during a Linux Debian upgrade from Sarge to Etch, which changed the location where some Apache2 stuff was installed. And there is still some difference to this day in some Perl scripts or modules between these two systems, which greatly bothers me, but it basically works.

The main difference is in the two first "use" statements in our "startup.pl" script (which I assume you are familiar with, as a way to pre-load some perl stuff when the server starts). I do not remember precisely which problems we had, but they were of the same "general gist" as yours, so maybe this helps.
Here it goes :

1) system "colin"  (Debian Sarge, older)
=================
version (uname -a) :
Linux colin 2.6.8-11-amd64-k8 #1 Sun Oct 2 21:26:54 UTC 2005 x86_64 GNU/Linux
Apache2 version : see below
Perl version (perl -v) : 5.8.4
mod_perl version (per Apache log) :
[Wed Feb 13 22:24:59 2008] [notice] Apache/2.0.54 (Debian GNU/Linux) DAV/2 mod_jk/1.2.6 PHP/4.3.10-22 mod_perl/1.999.21 Perl/v5.8.4 configured -- resuming normal operations

mod_perl "startup.pl" script :  (invoked via "PerlRequire" in httpd config)
------------------------------

#!/usr/bin/perl
# modperl2_startup.pl
# Apache2 / mod_perl 2 startup script

  use Apache2 ();
  use Apache::compat ();
  use lib "/usr/lib/apache2/perllib";   # that's a local perl lib directory
  use lib "/home/EFS/lib"; # that also
  use ModPerl::Util ();
  use Apache::RequestRec ();
  use Apache::RequestIO ();
  use Apache::RequestUtil ();
  use Apache::Filter ();
  use Apache::ServerUtil ();
  use Apache::Connection ();
  use Apache::Log ();
  use Apache::Const -compile => qw(:common :log REDIRECT);
  use APR::Const -compile => ':common';
  use APR::Table ();
  use ModPerl::Registry ();
  use CGI ();
  CGI->compile(':all');
  1;

lines in httpd.conf :
(or, rather, in /etc/apache2/mods-available/perl.conf) :
PerlRequire "/usr/lib/apache2/perllib/modperl2_startup.pl"
SetEnv PERL5LIB "/usr/lib/apache2/perllib"




2) system "arthur"  (Debian Etch, more recent)
  ==================
version (uname -a) :
Linux arthur 2.6.18-4-686 #1 SMP Wed May 9 23:03:12 UTC 2007 i686 GNU/Linux

Apache2 version : see below
Perl version (perl -v) : 5.8.8
mod_perl version (per Apache log) :
[Wed Feb 13 22:29:38 2008] [notice] Apache/2.2.3 (Debian) DAV/2 mod_jk/1.2.18 PHP/4.4.4-8+etch4 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_perl/2.0.2 Perl/v5.8.8 configured -- resuming normal operations

mod_perl "startup.pl" script :
------------------------------

  #!/usr/bin/perl
# modperl2_startup.pl
# Apache2 / mod_perl 2 startup script

  use Bundle::Apache2 ();
  use Apache2::compat ();
use lib "/usr/local/lib/apache2/perllib"; # that's a local perl lib directory
  use lib "/home/EFS/lib"; # that also
  use ModPerl::Util ();
  use Apache2::RequestRec ();
  use Apache2::RequestIO ();
  use Apache2::RequestUtil ();
  use Apache2::Filter ();
  use Apache2::ServerUtil ();
  use Apache2::Connection ();
  use Apache2::Log ();
  use Apache2::Const -compile => qw(:common :log REDIRECT);
  use APR::Const -compile => ':common';
  use APR::Table ();
  use ModPerl::Registry ();
  use CGI ();
  CGI->compile(':all');
  1;

lines in httpd.conf :
(or, rather, in /etc/apache2/mods-available/perl.conf) :
PerlRequire "/usr/local/lib/apache2/perllib/modperl2_startup.pl"
SetEnv PERL5LIB "/usr/local/lib/apache2/perllib"




Petry Roman, IT wrote:
Hello Perrin, thanks for this hint.. here comes the output..

Lodded modules in %INC:
re.pm APR/Const.pm File/Spec/Functions.pm Apache2/URI.pm APR/Status.pm warnings.pm Apache2/Connection.pm Apache2/XSLoader.pm Apache2/Util.pm Fcntl.pm Symbol.pm Exporter.pm ModPerl/RegistryCooker.pm Apache2/Response.pm File/Spec.pm Apache2/Const.pm Apache2/ServerUtil.pm APR/Date.pm ModPerl/Global.pm mod_perl.pm warnings/register.pm XSLoader.pm APR/Bucket.pm /etc/apache2/mod_perl-startup.pl Apache2/SubRequest.pm Apache2/Log.pm ModPerl/Const.pm Apache/Table.pm Apache2/Filter.pm APR/URI.pm base.pm APR/Util.pm File/Basename.pm Config.pm Apache2/RequestRec.pm ModPerl/Util.pm APR/Pool.pm mod_perl2.pm Carp.pm File/Spec/Unix.pm Apache2/RequestUtil.pm APR.pm Apache.pm strict.pm vars.pm CGI/Carp.pm constant.pm APR/XSLoader.pm Apache2/compat.pm Apache2/ServerRec.pm Apache2/Access.pm Apache/Constants.pm APR/Brigade.pm AutoLoader.pm Apache2/Module.pm lib.pm ModPerl/Registry.pm DynaLoader.pm Apache2/RequestIO.pm Apache/File.pm APR/Table.pm sum: 61 Looks ok i think. Apache.pm is loaded.. So why can´t i get it to work.. damn thing 8-).
bye
roman
-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Auftrag von Perrin
Harkins
Gesendet: Mittwoch, 13. Februar 2008 20:47
An: Petry Roman, IT
Cc: modperl@perl.apache.org
Betreff: Re: MP1 -> MP2 migration Problems.


On Feb 13, 2008 9:09 AM, Petry Roman, IT <[EMAIL PROTECTED]> wrote:
Can't locate object method "request" via package "Apache" at /usr/lib/cgi-bin/test1.pl line 4.

If Apache2::compat is loaded, it should create that namespace.  Dump
%INC from your script and see if Apache.pm is in it.

- Perrin


Reply via email to