hello i dont know if anyone read my last post, but i made a perl script that would track where people go on my site, so if they went to "my portfolio" then when the section loaded a perl script would update the current count for that section, i thought that it would get pretty prossesor intensive, if that script was being run a ton, like if 4 people were on my site, and they were all visiting sections at different times..wouldent it get kinda crazy....i am new to this so i dont really know how the server would handle it all. so if someone could enlighten me that would ROCK!...
but i have been experimenting with logging all the sections they click on in a single session, then have it when they close the page, send all the sections visited in a session, to the perl script. and then it updates the count. but the problem is, that i cant get it to send anything to the perlscript on unload, and i think its cause it closes the browsers connection with the server... but i dont know enough about it so i come to all the smart people.. the cgi mailing list--- please excuse my strange style of coding ps. this is on win32 FYI here is my perl: #!C:\Perl\bin\Perl.exe $clickfile = qw(C:\sectionsclicked.dat); %input = &get_input; %click = &readClicks; &print_click; sub readClicks{ open(CLICK, "$clickfile") || die "cannot open $clickfile: $!"; $size = -s CLICK; read(CLICK, $temp, $size) || die "Cannot read from file: $!"; @sections = split(/&/, $temp); foreach $sec (@sections){ ($section, $clicks) = split(/=/, $sec); $clickhash{$section} = $clicks; } close(CLICK); %clickhash; } sub print_click{ open(CLICK, ">$clickfile") || die "cannot open $clickfile: $!"; foreach $key (keys(%click)){ $click{$key} = ($click{$key})+($input{$key}); print CLICK "$key\=$click{$key}\&"; } close(CLICK); } sub get_input { my ($buffer, @pairs, $pair, $name, $value, %FORM); $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%(..)/pack("C", hex($1))/eg; $FORM{$name} = $value; } %FORM; } here is my html code: just for testing <html> <head> <title>Nate unload test</title> <script language="JavaScript"> function addclicks(section){ sessionclicks[section].value++; alert("you just clicked: "+section+" and you clicked it: "+sessionclicks[section].value+" times."); } function submitIt(){ document.sessionclicks.submit(); } </script> </head> <body onunload="javascript:submitIt();"> <a href="javascript://" onclick="addclicks('somesection')">click me</a><br> <a href="javascript:submitIt();">submit me</a> <!---------session Clicks---------> <form action="cgi-bin/clicklogger/click.pl" method="post" name="sessionclicks"> <input type="Hidden" name="somesection" value="0"> <input type="Hidden" name="somebutton" value="0"> <input type="Hidden" name="mutebutton" value="0"> <input type="Hidden" name="sitemap" value="0"> <input type="Hidden" name="links" value="0"> </form> </body> </html> i would love any help thanx nate