To show the output of a perl program in a html page. I have acounter program in

JAGa

New member
perl and i don't know how to? bring the output into a html page. Below is the perl code. I tried some times for this output. Please give the correct alternate coding to display the output of this program into an html page. CODING::::
------------------------------------------------------
#!/usr/local/bin/perl
print "Content-Type: text/html\r\n\r\n";
open(display,"+<home_page.txt");
$show = <display>;
++$show;
seek(display,0,0);
print display $show;
close display;
print $show;
---------------------------------------
THANKS IN ADVANCE
 
There are four points to my answer.
1. You forgot "use strict;"
2. You forgot "use warnings;"
3. Please use the CGI module.
4. Please use the File::CounterFile module.

AFTER YOU DO ALL THESE, ask again if it doesn't work. DO NOT REINVENT THE WHEEL
 
The easiest way is to include it the output of the counter program within an iFrame in your page:

<iframe width="100" height="40" id="counter" src="/cgi-bin/counter"></iframe>

(Change height and width to suit. Anything between the tags will be displayed in really ancient browsers that don't support iframes -- if anybody is still using those browsers in real life anymore.)

A more elaborate way involves having your script generate not text, but an image -- then you can call it up with an <img /> tag. For this to work, you will probably need an additional Perl module to interface to some library like GD or ImageMagick -- search and read the docs.
 
Back
Top