![]() |
#1
|
|||||
|
|||||
![]() 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 |
#2
|
|||||
|
|||||
![]() Titus, I'd say either the cgi script isn't in the cgi-bin directory, or the wrong permissions are set on the dir.
|
#3
|
||||
|
||||
![]() 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 ] |
#4
|
|||||
|
|||||
![]() 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 |
#5
|
||||
|
||||
![]() 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 ] |
#6
|
|||||
|
|||||
![]() 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 |
#7
|
||||
|
||||
![]() 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. |
#8
|
|||||
|
|||||
![]() Hello reefburnaby,
Um... it says bad data path. Mind explaining what this mean? $d = new DirHandle $DATA_PATH; Thanks Titus |
#9
|
||||
|
||||
![]() 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. |
#10
|
|||||
|
|||||
![]() 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 |