Run a perl script from an html page.

Posted on 2005-04-09
Medium Priority
Last Modified: 2010-03-05
How do I launch a perl script from an html page?????

Question by:jewee
  • 3

Accepted Solution

jhurst earned 1800 total points
ID: 13746051
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>

Author Comment

ID: 13747842
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?

Expert Comment

ID: 13748262
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!

LVL 48

Assisted Solution

Tintin earned 200 total points
ID: 13749390
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).

Expert Comment

ID: 13749439
good popint I did forget that file:// is a legitimate protocol for most browsers.  But I doubt that he is doing that

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

On Microsoft Windows, if  when you click or type the name of a .pl file, you get an error "is not recognized as an internal or external command, operable program or batch file", then this means you do not have the .pl file extension associated with …
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question