Home: Perl Programming Help: Win32 Programming Help:
CGI Error



gaylord
stranger

Jul 2, 2001, 3:46 PM


Views: 9502
CGI Error

Hello

I am using WIn 2000 server. I have successfully installed perl and I have tested on some scripts.

My problem is that were I have to use the 'require tag' within a script, I am getting the following error :

"
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:


Can't locate newsconfig.cgi in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at C:\Inetpub\wwwroot\cgi-bin\mn\news.cgi line 14.

"

Even where the files are in the same directory.

This what an extract of my code looks like

"
require "newsconfig.cgi"; #(This is line 14)

"

What am I doing wrong, please help

Gaylord



Jasmine
Administrator

Jul 2, 2001, 4:17 PM


Views: 9501
Re: CGI Error

Try using :


Code
require 'C:\Inetpub\wwwroot\cgi-bin\mn\newsconfig.cgi'; #(This is line 14)




yapp
User

Oct 3, 2001, 2:26 AM


Views: 9457
Re: CGI Error

He, this works aswell. (got it from the YaBB forum code)
After this code, your original code should work perfectly.


Code
BEGIN 
{
$THIS_PATH = 'path';
if($ENV{'SERVER_SOFTWARE'} =~ /IIS/)
{
push @INC, $THIS_PATH;
chdir($THIS_PATH);
}
}



The current directory in IIS appears to be the WWW-root all the time. I found that out when using the Cwd module. The $THIS_PATH could also be determinied by examining $0. Do this the way you like, either with a regexp, or with substr() and index().

This helped me out of much trouble in IIS, and makes the script platform-independant.



Cure
User

Nov 29, 2002, 10:21 AM


Views: 8649
Re: [gaylord] CGI Error

perldoc require

perldoc lib





Cure