[Melbourne-pm] Run Perl Script from HTML

Toby Wintermute tjc at wintrmute.net
Thu Sep 24 05:20:37 PDT 2009


2009/9/24 Gerd Berner <gberner at intraspect.com.au>:
> Hello All
>
> I have a simple one page HTML application that I want to distribute to a
> number of workstations (that will not have a HTTP server installed).  The
> page has a graph which I want to be able to refresh using a perl script, but
> I havent been able to find a way to execute the perl script via a button on
> the page, without any help from CGI.

HTML is, for fairly good reason, not able to execute code on the
machine it's browsed from, or anywhere for that matter, except in the
Javascript/Flash/etc sandboxes. (Which are also forbidden from
executing code on your machine)
So you will need to do something like CGI..
However, you don't need a web server to be installed for that.

Your Perl script can quite happily open up port 80 (or another,
non-reserved port) and listen for HTTP requests upon it.
(In effect, your Perl script becomes a stand-alone web server.)

Cheers,
Toby


More information about the Melbourne-pm mailing list