Forum Moderators: phranque

Message Too Old, No Replies

Problem Accessing Perl Modules Through .htaccess

         

monkfan

3:27 am on Apr 10, 2007 (gmt 0)

10+ Year Member



Dear experts,

I have the following simple Perl script (called "hellom.cgi"):

__BEGIN__
#!/usr/bin/perl
use CGI qw/:standard :html3/;
use CGI::Carp qw( fatalsToBrowser );
$CGI::POST_MAX=1024 * 100; # max 100K posts1

#--------------------------------------------------
# BEGIN {
# if ( $ENV{PERL5LIB} and $ENV{PERL5LIB} =~ /^(.*)$/ ) {
#
# # Blindly untaint. Taintchecking is to protect
# # from Web data;
# # the environment is under our control.
# eval "use lib '$_';" foreach (
# reverse
# split( /:/, $1 )
# );
# }
# }
#--------------------------------------------------

use Acme::Spork;
use Bio::Tools::GuessSeqFormat;
print "Content-type: text/html\n\n";
print "Hello World! It works.\n";

__END__

Which is stored under: /usr/local/apache/htdocs/Test/cgi-bin
<snip>
It gives error message like this:


Software error:
Can't locate Acme/Spork.pm in @INC (@INC contains: /home/sadm/lib/site_perl/ /home/sadm/lib/site_perl/sun4-solaris-64int /usr/perl5/5.8.4/lib/sun4-solaris-64int /usr/perl5/5.8.4/lib /usr/perl5/site_perl/5.8.4/sun4-solaris-64int /usr/perl5/site_perl/5.8.4 /usr/perl5/site_perl /usr/perl5/vendor_perl/5.8.4/sun4-solaris-64int /usr/perl5/vendor_perl/5.8.4 /usr/perl5/vendor_perl .) at /usr/local/apache/htdocs/Test/cgi-bin/hellom.cgi line 25.
BEGIN failed--compilation aborted at /usr/local/apache/htdocs/Test/cgi-bin/hellom.cgi line 25.
For help, please send mail to the webmaster (admin@your-domain.com), giving this error message and the time and date of the error.


As you can see from that link it shows that it can't locate Acme::Spork
at the shown path there - although the path stated above (the one under /home) is already consistent with my htaccess path below:


SetEnv PERL5LIB /home/sadm/lib/site_perl/sun4-solaris-64int:/home/sadm/lib/site_perl/

The .htaccess is located here:
/usr/local/apache/htdocs/Test.

Moreover checking the location of the module it consistently shows the correct path:


sadm@bioinfo:~/lib/site_perl/Acme$ ls
Spork.pm
sadm@bioinfo:~/lib/site_perl/Acme$ pwd
/home/sadm/lib/site_perl/Acme

My question is why my Apache can't locate the location
given my correct .htaccess path? Thus my script won't work?

<snip>

[edited by: jdMorgan at 12:49 pm (utc) on April 10, 2007]
[edit reason] No URLs, please. See Terms of Service. [/edit]

gabriel01

10:29 pm on Apr 10, 2007 (gmt 0)

10+ Year Member



SetEnv PERL5LIB /home/sadm/lib/site_perl/sun4-solaris-64int:/home/sadm/lib/site_perl/

Try removing the trailing '/':

SetEnv PERL5LIB /home/sadm/lib/site_perl/sun4-solaris-64int:/home/sadm/lib/site_perl