[Melbourne-pm] Run Perl Script from HTML
Gerd Berner
gberner at intraspect.com.au
Thu Sep 24 05:41:46 PDT 2009
hmmm....
That could be a good option, I could open a port ,make a call to
system to start the browser, and pass it the URL. The perl 'listener'
can then handle any redrawing of the graph that is required.
On 24/09/2009, at 10:24 PM, Scott Penrose wrote:
>
> On 24/09/2009, at 10:20 PM, Toby Wintermute wrote:
>
>>
>> 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.)
>
> Yes, as Toby has said here, you can do it by running Perl. And with
> Strawberry perl and PAR you should be able to do it with one or two
> clicks for the operator. E.g. it might be run the program then go to
> the URL.
>
> Try HTTP::Daemon - I think it is fairly common
>
> SYNOPSIS
> use HTTP::Daemon;
> use HTTP::Status;
>
> my $d = HTTP::Daemon->new || die;
> print "Please contact me at: <URL:", $d->url, ">\n";
> while (my $c = $d->accept) {
> while (my $r = $c->get_request) {
> if ($r->method eq 'GET' and $r->url->path eq "/
> xyzzy") {
> # remember, this is *not* recommended practice :-)
> $c->send_file_response("/etc/passwd");
> }
> else {
> $c->send_error(RC_FORBIDDEN)
> }
> }
> $c->close;
> undef($c);
> }
>
>
> Scott
>
More information about the Melbourne-pm
mailing list