Operating System - HP-UX
1830855 Members
2422 Online
110017 Solutions
New Discussion

Apache2.pm not found in perl, Yet I easily see it.

 
SOLVED
Go to solution
Steve Post
Trusted Contributor

Apache2.pm not found in perl, Yet I easily see it.

cat ./junk.pl
#!/usr/bin/perl
use Apache2;
print "hi there\n";


./junk.pl
Can't locate Apache2.pm in @INC (@INC contains: /scrap/perl_5.8.8/lib/5.8.8/PA-RISC2.0 /scrap/perl_5.8.8/lib/5.8.8 /scrap/perl_5.8.8/lib/site_perl/5.8.8/PA-RISC2.0 /scrap/perl_5.8.8/lib/site_perl/5.8.8 /scrap/perl_5.8.8/lib/site_perl .) at ./junk.pl line 2.
BEGIN failed--compilation aborted at ./junk.pl line 2.

find /scrap/perl_5.8.8/lib -name "Apache2*"
/scrap/perl_5.8.8/lib/site_perl/5.8.8/PA-RISC2.0/auto/Apache2
/scrap/perl_5.8.8/lib/site_perl/5.8.8/PA-RISC2.0/Apache2
/scrap/perl_5.8.8/lib/site_perl/5.8.8/PA-RISC2.0/Bundle/Apache2.pm

Well I can find it. Why can't perl?

perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
Platform:
osname=hpux, osvers=11.23, archname=PA-RISC2.0
uname='hp-ux mactac6 b.11.23 u 9000800 3074395246 unlimited-user license '
config_args='-Dcc=gcc -Dmake=gmake'
.........
Built under hpux
Compiled at Sep 29 2009 12:39:40
@INC:
/scrap/perl_5.8.8/lib/5.8.8/PA-RISC2.0
/scrap/perl_5.8.8/lib/5.8.8
/scrap/perl_5.8.8/lib/site_perl/5.8.8/PA-RISC2.0
/scrap/perl_5.8.8/lib/site_perl/5.8.8
/scrap/perl_5.8.8/lib/site_perl

5 REPLIES 5
James R. Ferguson
Acclaimed Contributor
Solution

Re: Apache2.pm not found in perl, Yet I easily see it.

Hi Steve:

You said:

use Apache2:

...but I think you want:

use Bundle::Apache2

Regards!

...JRF...
Steve Post
Trusted Contributor

Re: Apache2.pm not found in perl, Yet I easily see it.

Thank you! Geeeeez. I was really wasting my time searching for this.
Steve Post
Trusted Contributor

Re: Apache2.pm not found in perl, Yet I easily see it.

It is one step forward, two steps back. I continued to try to get existing perl scripts from mod_perl1, apache1 to work with mod_perl2, apache2.

prob: It dies on "use Apache;" and "use Apache2"
It says it's not around but it is in the @INC path.
solution: In startup_perl.pl change
from use Apache;
to use Bundle::Apache
Thanks for the help.

prob: It won't show simple html doc
It won't show any TEXT unless <60 chars?!
solution: change these two lines in html.conf
From: # EnableSendfile off
To: EnableSendfile off
From: # EnableMMAP off
To: EnableMMAP off
Have fun looking for THIS one on the web.

It dies on "use Apache::Constants;"
in perlscript.pm change
from: use Apache::Constants qw(:common);
to: use Apache2::Const qw(:common);
I found this one somewhere they were talking about mod_perl2.

I really started to look for a mod_perl1 to perl2 conversion steps. I couldn't find it.
I need it. Because.......

prob: In this perlscript.pm code
sub handler {
my $r = shift;
my %params = ($r->content, $r->args);

I get this error on the apache server....
Can't locate object method "content" via package "Apache2::RequestRec" at /apache/perl/lib/dir/perlscript.pm line 20.
solution? I can't find it yet.

I only have 3,234,343,334 hurtles to go?

Isn't there a mod_perl page that shows you the code changes?
Like: Change "use Apache" to "use Bundle::Apache2".
Change "use Apache::Constants" to "use Apache2:Const"
Change "xxxxx" to "yyyyy" where xxxxx and yyyyy are about 40,000 little pieces of code?

Steve Post
Trusted Contributor

Re: Apache2.pm not found in perl, Yet I easily see it.

http://perl.apache.org/docs/2.0/user/porting/compat.html

I could not find this link yesterday.
Go figure.
I like its title:

A Reference to mod_perl 1.0 to mod_perl 2.0 Migration.
That is EXACTLY what I was looking for.
Steve Post
Trusted Contributor

Re: Apache2.pm not found in perl, Yet I easily see it.

Also in
mod_perl: Getting Your Feet Wet with mod_perl (version 2)
And its link.......... http://perl.apache.org/docs/2.0/user/intro/start_fast.html

I can add this to httpd.conf...
LoadModule perl_module modules/mod_perl.so
PerlModule Apache2::compat


LoadModule perl_module modules/mod_perl.so
---this line tells apache to use mod_perl.

PerlModule Apache2::compat
---this line tells apache to require Apache2::Compat module. This module allows mod_perl version 1 syntax.

I would consider this a workaround until the perl code was updated from mod_perl1 format.