Currently I am trying to use a bunch of custom perl modules, test.pm as one of them, within my Perl program with a WebUI. I am running it on a Windows 7 machine with Apache2 installed. When I run the program in cmd prompt by using perl test.pl, the program runs fine. However running it on Apache gives me this error.
[Wed Jun 13 16:23:32 2012] [error] [client 127.0.0.1] Can't locate test.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at C:/www/hello2.pl line 7.\r, referer: http://localhost/ui_test.htm
[Wed Jun 13 16:23:32 2012] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at C:/www/hello2.pl line 7.\r, referer: http://localhost/ui_test.htm
I have used:
foreach $key (sort keys(%ENV)) {
print "$key = $ENV{$key}<p> \n";
}
and under the path variable, I do see the folder of where all the modules are located. Is there somewhere else I should use to add to the Perl Path?
In addition adding use lib "C:\testpm\"; to my code only changes the @INC to
(@INC contains: C:\testpm\ C:/Perl/lib C:/Perl/site/lib .)
Is there something additional you need to do to add paths to run custom perl modules on an apache server?
Solution Based On Answer: I found this to work the best. Within my httpd-perl.conf file, I added these lines:
<IfModule env_module>
SetEnv PERL5LIB "C:\testpm;C:\testpm1;"
</IfModule>
(extended out with C:\testpm1 to show people with similar questions how to add even more module folders.)