Canreef Aquatics Bulletin Board  

Go Back   Canreef Aquatics Bulletin Board > Other > Lounge

Reply
 
Thread Tools Display Modes
  #1  
Old 08-18-2001, 09:10 PM
titus's Avatar
titus titus is offline
Administrator
 
Join Date: Aug 2001
Location: Hong Kong
Posts: 3,163
titus has disabled reputation
Default CGI expert?

Hello,

Trying to add some surveys to this site but had problems with the set up.
Please take a look at:
Test Survey

The script generated a "Data File is Missing!" messeage. Anyone has any clue?

Titus
Reply With Quote
  #2  
Old 08-18-2001, 11:04 PM
Aquattro's Avatar
Aquattro Aquattro is offline
Just a guy..
 
Join Date: Aug 2001
Location: Victoria, BC
Posts: 18,053
Aquattro is a jewel in the roughAquattro is a jewel in the roughAquattro is a jewel in the roughAquattro is a jewel in the rough
Default CGI expert?

Titus, I'd say either the cgi script isn't in the cgi-bin directory, or the wrong permissions are set on the dir.
Reply With Quote
  #3  
Old 08-20-2001, 12:44 AM
reefburnaby reefburnaby is offline
Member
 
Join Date: Aug 2001
Location: Burnaby, B.C.
Posts: 766
reefburnaby is on a distinguished road
Default CGI expert?

Hello Titus,

Does $DATA_PATH/clubschedule.srv exists ? If not...then thats the problem. I think the script is running...just missing some files.

You'll also need perms to read/write to $DATA_PATH srv and log files.

[ 19 August 2001: Message edited by: reefburnaby ]
Reply With Quote
  #4  
Old 08-20-2001, 03:14 PM
titus's Avatar
titus titus is offline
Administrator
 
Join Date: Aug 2001
Location: Hong Kong
Posts: 3,163
titus has disabled reputation
Default CGI expert?

Hello reefburnaby,

Yes, $DATA_PATH/clubschedule.srv does exist.
I'm looking at the cgi script and it has the following:
$DATA_FILE="$DATA_PATH/$SURVEY_NAME\.srv";
$LOG_FILE="$DATA_PATH/$SURVEY_NAME\.log";
if ( !-e $DATA_FILE){
print "Content-type: text/html\n\n Data File is Missing!\n";
exit;
}

The $DATA_PATH variable was declared by me using the correct path. However, a search for $SURVEY_NAME led to:

if ($fields{'survey_name'}=~/^([-\@\w.]+)$/){
$SURVEY_NAME=$fields{'survey_name'};
}

But I am unable to see %fields being declared anywhere else. Perhaps you can shed some light on this.

Thanks
Titus
Reply With Quote
  #5  
Old 08-20-2001, 10:52 PM
reefburnaby reefburnaby is offline
Member
 
Join Date: Aug 2001
Location: Burnaby, B.C.
Posts: 766
reefburnaby is on a distinguished road
Default CGI expert?

Hello Titus,

I fired up IIS on my machine and installed the script. It seems to work....you might want to check what $DATA_PATH is being interpreted as. Silly things like wrong slash direction ('\' vs '/') can mess it up.

Try adding this to the offending 'if' command...

sub check_files{
$DATA_FILE="$DATA_PATH/$SURVEY_NAME\.srv";
$LOG_FILE="$DATA_PATH/$SURVEY_NAME\.log";
if ( !-e $DATA_FILE){
print "Content-type: text/html\n\n Data File is Missing!\n";
print $DATA_FILE;
exit;

when it dies...you should see if $DATA_FILE is correct. $DATA_FILE should be a path that is valid to the perl interpreter. ie. mine is c:\inetpub\wwwroot\survey\survey.srv.

BTW, %fields is passed through the html form.

Hope that helps.

[ 20 August 2001: Message edited by: reefburnaby ]
Reply With Quote
  #6  
Old 08-21-2001, 01:43 AM
titus's Avatar
titus titus is offline
Administrator
 
Join Date: Aug 2001
Location: Hong Kong
Posts: 3,163
titus has disabled reputation
Default CGI expert?

Hello reefburnaby,

Thanks for the debugging tip.
I implemented that and I can see the path, which is another way to say it still doesn't work.

If you click the submit button again you'll see the following:
Data File is Missing! /userweb/titus/web/survey/cgi-bin/clubschedule.srv

And if you enter the following as URL you'll see the data file: http://www.canreef.com/survey/cgi-bin/clubschedule.srv

So the path is correct and the data file is there. I wonder what is going on here.

Titus
Reply With Quote
  #7  
Old 08-21-2001, 03:34 AM
reefburnaby reefburnaby is offline
Member
 
Join Date: Aug 2001
Location: Burnaby, B.C.
Posts: 766
reefburnaby is on a distinguished road
Default CGI expert?

Hello Titus,

Sounds like you are on a unix system of some sort (right ?). I guess the program still can't see the file.

Try this code :

sub check_files{
$DATA_FILE="$DATA_PATH/$SURVEY_NAME\.srv";
$LOG_FILE="$DATA_PATH/$SURVEY_NAME\.log";
if ( !-e $DATA_FILE){
print "Content-type: text/html\n\n Data File is Missing!\n";
print $DATA_FILE;

use DirHandle;

$d = new DirHandle $DATA_PATH;
if (defined($d)) {
print "<BR>Good Data Path";
}
else {
print "<BR> Bad Data Path";
}
while (defined($_ = $d->read)) {
print $_ . "<br>";
}
exit;
}

if (!-e ....

This should tell you if you have a bad path or not. It should also tell you if you are looking at the right directory (i.e. it prints out the directory for you).

The good news is that I tried out your clubschedule code on my machine and it works fine.

Hope that helps.
Reply With Quote
  #8  
Old 08-21-2001, 02:23 PM
titus's Avatar
titus titus is offline
Administrator
 
Join Date: Aug 2001
Location: Hong Kong
Posts: 3,163
titus has disabled reputation
Default CGI expert?

Hello reefburnaby,

Um... it says bad data path.
Mind explaining what this mean?
$d = new DirHandle $DATA_PATH;

Thanks
Titus
Reply With Quote
  #9  
Old 08-21-2001, 09:43 PM
reefburnaby reefburnaby is offline
Member
 
Join Date: Aug 2001
Location: Burnaby, B.C.
Posts: 766
reefburnaby is on a distinguished road
Default CGI expert?

Hello,

Sorry about going over your head....

The code I posted is suppose to read the directory at $DATA_PATH.

so...
$d = new DirHandle $DATA_PATH
opens a handle, $d, that can be used to get the file names in the subdirectory $DATA_PATH.

if $d is not defined, then perl was not able
to open $DATA_PATH. Hence, returns "Bad Data Path". If the data path is good, then the next section of code will read the file names from the subdirectory $DATA_PATH into $_ and print it out. print "<BR>" is an HTML code that causes a line break.

I guess you are wondering where we should go from here. From what I can see, the path $DATA_PATH is not correct. So, we will try something else like :

$DATA_PATH = ".";

In theory, it should print out the directory of something -- this something should be what ever is in cgi-bin (not sure, but thats what mine does). Try mucking around with the $DATA_PATH until it works or you see something familiar.

Try

$DATA_PATH = "/" or "/userweb/titus"

I guess that problem is a bit more complicated that you had hoped...so we should take this offline since it is a pain try to explain it over a bulletin board. My name is Victor. So you can give me a call at home @ 420-8789 or at work at 415-6000-2033.
Reply With Quote
  #10  
Old 08-23-2001, 04:10 AM
titus's Avatar
titus titus is offline
Administrator
 
Join Date: Aug 2001
Location: Hong Kong
Posts: 3,163
titus has disabled reputation
Default CGI expert?

Hello reefburnaby,

Thanks for your help. We got it up and running now. Turned out that there 2 more layers of directories I have to set in the $DATA_PATH variable.

Thanks again,
Titus
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 10:36 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.