d.mc2
d.mc2

Reputation: 1129

Interfacing with Local Perl Script from a Web UI

Given that I have a local Perl script that prints "Hello" in a windows command prompt.

I want to make a Web Interface that when I click a button on an HTML page using Javascript or something, I'd be able to execute this local Perl Script. I have tried hosting the page on Localhost in an Xampp Apache server however this uses the Perl installed on Xampp.

Is there anyway to interact with local Perl from a Web User Interface? i.e. Running a perl script in the local shell from a Web UI.

Upvotes: 0

Views: 1136

Answers (2)

user3458
user3458

Reputation:

I usually run a perl script that works as a primitive web server. Upon startup it prints a URL which can be used to access it.

This can be done with the following modules:

use HTTP::Daemon;
use HTTP::Status;
use HTTP::Response;

in about 60 lines of code.

Can't post my code, but here is a more elaborate sample (it uses fork, which is an improvement over what I have): http://www.perlmonks.org/?node_id=415908

Upvotes: 3

PinkElephantsOnParade
PinkElephantsOnParade

Reputation: 6592

Look into Node JS... it can call perl from the webpage, is very very simple to set up and get a localhost site going, and is free.

Upvotes: 0

Related Questions