I'm teaching a course to 7th and 8th graders. I sent out homework assignments over the web. I'm in the process of learning Perl and could use a little help....again.<br>
<br>
I'm writing my own web visit counter which runs behind the scene away for user visability. I know there are several counters available that are already written, but I'm just trying to learn Perl (...learn by doing, except in this case I need some help).<br>
<br>
Anyway, inside the web file "index.html" I have the following statement:<br>
<br>
<!--#exec cgi="/cgi-bin/count.cgi"--><br>
<br>
My understanding is that this statement should activate the perl script called count.cgi which is in the folder cgi-bin.<br>
<br>
File "count.cgi" contains the following:<br>
<br>
#!/usr/bin/perl<br>
print "Content-type: text/html\n\n";<br>
$file="count.count" ¦¦ print "Failed to obtain file name $file, $!<BR>\n";<br>
open (COUNT, "$file"
¦¦ print "failed to open $file, $!<BR>\n";<br>
$val = <COUNT>;<br>
$val++;<br>
close (COUNT);<br>
open (OUT, ">$file"
¦¦ print "faile to open OUT=$file, $!<BR>\n";<br>
print OUT $val;<br>
close (OUT);<br>
exit;<br>
<br>
The perl script works great when I use the "perl count.cgi" command; however it doesn't work at all via the web. Permissions have been set fine for the file count.cgi and count.count which contains the counter.<br>
<br>
I suspect that the count.cgi script is never actually running because of a linkage problem between the #exec command within the webpage and the script on the server.<br>
<br>
Question #1: Anyone have a guess or can guide me in the right direction? I've tried many different configurations of the #exec command....nothing seems to work.<br>
<br>
question #2: After incrementing the value of the number in file count.count; I'd like to append a line at the bottom of a separate file which contains detailed data about each student access to the file. I'd like to mark the date, time, and other easy-to-obtain student data and append the information in a single line at the bottom of a file (i.e. create a transaction file for each access). Any ideas?<br>
<br>
thanks,<br>
<br>
Jerry<br>
<br>
I'm writing my own web visit counter which runs behind the scene away for user visability. I know there are several counters available that are already written, but I'm just trying to learn Perl (...learn by doing, except in this case I need some help).<br>
<br>
Anyway, inside the web file "index.html" I have the following statement:<br>
<br>
<!--#exec cgi="/cgi-bin/count.cgi"--><br>
<br>
My understanding is that this statement should activate the perl script called count.cgi which is in the folder cgi-bin.<br>
<br>
File "count.cgi" contains the following:<br>
<br>
#!/usr/bin/perl<br>
print "Content-type: text/html\n\n";<br>
$file="count.count" ¦¦ print "Failed to obtain file name $file, $!<BR>\n";<br>
open (COUNT, "$file"
$val = <COUNT>;<br>
$val++;<br>
close (COUNT);<br>
open (OUT, ">$file"
print OUT $val;<br>
close (OUT);<br>
exit;<br>
<br>
The perl script works great when I use the "perl count.cgi" command; however it doesn't work at all via the web. Permissions have been set fine for the file count.cgi and count.count which contains the counter.<br>
<br>
I suspect that the count.cgi script is never actually running because of a linkage problem between the #exec command within the webpage and the script on the server.<br>
<br>
Question #1: Anyone have a guess or can guide me in the right direction? I've tried many different configurations of the #exec command....nothing seems to work.<br>
<br>
question #2: After incrementing the value of the number in file count.count; I'd like to append a line at the bottom of a separate file which contains detailed data about each student access to the file. I'd like to mark the date, time, and other easy-to-obtain student data and append the information in a single line at the bottom of a file (i.e. create a transaction file for each access). Any ideas?<br>
<br>
thanks,<br>
<br>
Jerry<br>