Run a perl script from an html page.

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

Question by:jewee
    LVL 8

    Accepted Solution

    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

    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?
    LVL 8

    Expert Comment

    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

    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).
    LVL 8

    Expert Comment

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

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Join & Write a Comment

    Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
    There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
    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…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.

    745 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

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now