Apache mod_perl2 migration problem
I have an apache2 config file under /etc/init.d/apache2/conf.d/ which uses Perl Sections.
I am just trying to test if a module is loaded and configure apache as appropriate.
if( Apache->module( "mod_ssl.c" ) )
{
...
} else { ... }
This is the error I see though when restarting. I've also tried Apache2->method but get same error.
# /etc/init.d/apache2 restart Restarting web server: apache2Building Appliance configuration for Debian 5.0.7 Syntax error on line 73 of /etc/apache2/conf.d/foobar.conf: \t(in cleanup) Can't locate object method "module" via package "Apache" (perhaps you forgot to load "Apache"?) at /etc/apache2/conf.d/foobar.conf line 357.\n failed!
I don't think it is an @INC problem... And apache and libapache2-mod-perl2 packages are both installed. In fact if I comment that line out the rest of the perl actually runs fine.
perl -e 'print join "\n",@INC'
/etc/perl
/usr/local/lib/perl/5.10.0
/usr/local/share/perl/5.10.0
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.10
/usr/share/perl/5.10
/usr/local/lib/site_perl
I've also tried using the Apache::compat and "Apache2->module".
I suspect the problem is something is missing in startup.pl - but I've been googling and reading the mod perl docs and going round in circles. Any suggestions stackoverflow???BTW- my startup.pl:
#!/usr/bin/perl -w
use strict;
use lib qw( /usr/lib/perl5/ /usr/lib/perl5/Bundle /usr/lib/perl5/Apache2 ) ;
BEGIN
{
use Apache2 ();
my $hostname = `hostname`;
}
use Apache;
use A开发者_开发技巧pache::DBI ();
use Apache2::Const ();
use Apache2::Log ();
use Apache2::URI ();
use Apache2::compat;
use LWP::UserAgent ();
use DBI() ;
1;
The documentation on porting from 1.0 to 2.0 suggests Apache2::Module::loaded()
精彩评论