I’m trying to run this simple script in the browser and it keeps erroring out. If I run it in linux, it runs fine.
Script – test.pl:
#!/home/biotools/perl/5.10.0/bin/perl
use lib '/home/biotools/current/lib/site_perl/5.10.0';
use lib '/people/users/123456/classPath/lib';
use IngresLXSetupNoLog;
use strict;
use warnings;
use Path::Class; # this is line 8
my $dir = dir('./mydir'); # foo/bar
print "Content-type: text/html\n\n";
# Iterate over the content of foo/bar
while (my $file = $dir->next) {
# See if it is a directory and skip
next if $file->is_dir();
# Print out the file name and path
print $file->stringify . "\n";
}
Error:
[Tue Nov 29 08:46:29 2011] [error] Can't locate Path/Class.pm in @INC (@INC contains: /people/users/123456/classPath/lib /home/biotools/current/lib/site_perl/5.10.0/x86_64-linux /home/biotools/current/lib/site_perl/5.10.0 /usr/local/biotools/perl/5.10.0/lib/5.10.0/x86_64-linux /usr/local/biotools/perl/5.10.0/lib/5.10.0 /usr/local/biotools/perl/5.10.0/lib/site_perl/5.10.0/x86_64-linux /usr/local/biotools/perl/5.10.0/lib/site_perl/5.10.0 .) at /projects/apps/dev/cgi-bin/miscellaneous/studyinfo/test.pl line 8.
[Tue Nov 29 08:46:29 2011] [error] BEGIN failed--compilation aborted at /projects/apps/dev/cgi-bin/miscellaneous/studyinfo/test.pl line 8.
[Tue Nov 29 08:46:29 2011] [error] Premature end of script headers: test.pl
Where is the
.pmfile that definesPath::Class? (If you don’t know, try addingBEGIN { print "@INC\n"; }right before line 8, and running the script from the command line.)You need to add its parent directory to your
@INC, using anotheruse lib '...';pragma.