Installation

MOD_PERL_API_VERSION variable inherited from external scripts?

MOD_PERL_API_VERSION variable inherited from external scripts?

by Gavin LaRose -
Number of replies: 0
Hi all,

I've just installed WeBWorK on a new server with apache2, which is working fine, except when I try to load WeBWorK libraries in external scripts.

For example, I have a script where I define

$ENV{WEBWORK_ROOT} = '/.../webwork2';
use lib '/.../webwork2/lib';
use WeBWorK::ContentGenerator;

which on my old apache 1.3.x box worked fine. On the apache 2 box, I get two errors: first, it fails when it looks for mod_perl.pm (line 56 in ContentGenerator.pm:

use mod_perl;

which I can get around, though I don't think I should have to, by just making a link from mod_perl2.pm to mod_perl.pm in the appropriate perl directory.

After that, however, I get an error that indicates that ContentGenerator is loading the old mod_perl 1 Apache::Constants module instead of Apache2::Const. This is determined by the environmental variable MOD_PERL_API_VERSION. So I try to set that in the script, with

$ENV{WEBWORK_ROOT} = '/.../webwork2';
$ENV{MOD_PERL_API_VERSION} = 2;
use lib '/.../webwork2/lib';
use WeBWorK::ContentGenerator;

But that still fails: the environmental variable isn't being seen in WeBWorK::ContentGenerator. If I put a wrapper that presets the environmental variables, it works fine---that is, if I have a script that is just

#!/usr/bin/perl
$ENV{WEBWORK_ROOT} = '/.../webwork2';
$ENV{MOD_PERL_API_VERSION} = 2;
system("old_script");

then the old_script runs fine.

So, can anyone shed light on what's going on with (1) the "missing" mod_perl.pm file; and (2) the failure of the MOD_PERL_API_VERSION to propagate to the loaded WeBWorK libraries in the script?

Thanks,
Gavin