Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running Perl Script On Page Load

Status
Not open for further replies.

Qamgine

Programmer
Mar 6, 2001
126
US
I have written a perl counter. My problem is to run the script and have the contents appear on my home page? Could someone please tell me how to do this.

Thank you in Advance.
 
One of the easiest ways to do this is to call your counter program from an image tag on the page like this:
Code:
<img src=&quot;/cgi-bin/counter.pl&quot; width=&quot;1&quot; height=&quot;1&quot; border=&quot;0&quot;>
Then your counter program must output a 1x1 pixel transparent gif file (with appropriate header) as the last thing it does, like this subroutine does:
Code:
sub PrintPixel {
   my(@bytes) = (71,73,70,56,57,97,1,0,1,0,128,0,0,255,255,255,0,0,0,33,249,4,5,20,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59);
   print &quot;Content-type: image/gif\n\n&quot;;
   print pack('C*', @bytes);
   return 1;
}
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top