Run a perl script from an html page.

How do I launch a perl script from an html page?????

jeweeAsked:
Who is Participating?
 
jhurstCommented:
The most typical way is for the page to subit a form that does a .cgi request.

If you want the act of loading the page to do this then the page will need to refresh itself with a meta tag or some Javascript that loads the requested page that does the .cgi.

Basically once a page has been sent to the browser the server is out of the loop.  It sends the page and is done.  So, if you want the page to do it, then it needs to do soemthign else.

Now, if you just mean that you want the page to be geneated by the script then this is clearly much easier, eg:

<a href="yourScript.cgi">click here to do something</a>
0
 
jeweeAuthor Commented:
Can I use cgi?  I am not running a web server from this particular machine.  I read another post where it said to use image which will then run the script.  Would that be a possible solution?
0
 
jhurstCommented:
Yes, an <img src="something.cgi" width="1" height="1"> would work well too.

Now, if you are not running a web server then how do the pages get to the client?

You will need a web server so that the computer that is to run the script can actually receive and know what to do with the requests generated on the web page.  It would be VERY SCARY if there were some way round that.  COnsider the possibility of web pages writen by others executing code on your computer!

0
 
TintinCommented:
You can have a local web site without a webserver, where all the HTML pages are just local links, however, by it's very nature and definition, you need a webserver to run CGI programs (that you can view the results with a browser).
0
 
jhurstCommented:
good popint I did forget that file:// is a legitimate protocol for most browsers.  But I doubt that he is doing that
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.