Your skill will accomplish
what the force of many cannot
Require a script not found in @INC arrayby TJD (Initiate)
|on Oct 07, 2004 at 03:00 UTC||Need Help??|
TJD has asked for the
wisdom of the Perl Monks concerning the following question:
I have half a dozen scripts that make up a shopping cart system. The main script calls subroutine scripts using a Require function (e.g. require "config.cgi";).
I've developed the system on a Linux server and now I've leased website space with www.omnis.com to begin final testing and production. The Omnis server is also running with Linux.
The problem: The scripts won't run on the Omnis.com server. When I try to call the system I get the dreaded 500 Internal Server Error message. To say that the Omnis technical people have been less than helpful would be a gross understatement. They loaded a three line script into my cgi-bin and ran it, reporting that the system works and that's the most they can do. They say that debugging code isn't their responsibility. I never asked them to debug the script, and they completely ignored my request for information about error messages on the server logs.
Using a script called AdminPro, I've learned that the main script is failing when it reaches the Require function that calls the configuration subroutine. That occurs at the very start of the script. The error message says:
Can't locate config.cgi in @INC (@INC contains: /etc/perl /usr/lib/perl5/site_perl/5.8.4/i686-linux /usr/lib/perl5/site_perl/5.8.4 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.4/i686-linux /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.4/i686-linux /usr/lib/perl5/5.8.4 /usr/local/lib/site_perl .) line 12.
From experience I know that this message usually pops up when there's a problem with the subroutine script, but these scripts are all working perfectly on the testing server. The permissions on the new server are correct, the scripts all pass Omnis Perl checker for correct syntax, and I uploaded them correctly.
I thought that scripts within the same file directory were automatically loaded into the @INC array but I guess that I was wrong. And on the possibility that relative addressing isn't working, I changed the Require function to reflect the full path. No difference.
1) Is the @INC array unique to each website, or is it a common array used by all websites on that server?
2) Is it possible that the server is set not to allow the use of the Require function that so people can't contaminate the @INC array with special mods?
3) Is there a way to force the loading into the @INC array?
I'll be grateful for any suggestions since the people at Omnis.com won't provide any help at all.
Thanx in advance for any help you can provide.