Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Running a perl script from a html page

by Ankit.11nov (Acolyte)
on Dec 10, 2009 at 08:53 UTC ( #812125=perlquestion: print w/replies, xml ) Need Help??
Ankit.11nov has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I want to run a perl script from a html web page.
<html> <head> <title>Run your first Perl script</title> </head> <body> Click on <a href="D:\workspace\">this link</a> to run your first + Perl script. </body> </html>

But when I am clicking on the link it is downloading the file instead of running it.
Please suggest what can be done here.

Replies are listed 'Best First'.
Re: Running a perl script from a html page
by Utilitarian (Vicar) on Dec 10, 2009 at 09:47 UTC
    The url you have supplied is local, and so will just pull the file off your D: drive. you need to
    • install a webserver, I'd suggest Apache, but that's cos I like it
    • Configure a CGI directory in your webserver
    • Copy your script to this directory
    • Edit your page so that the link points to the absolute HTTP path to your script
    the info above is readily available on-line, however your question indicates a lack of understanding of the HTTP and CGI protocols, you should do a bit of reading to familiarise yourself with these. That said learning by doing is also to be recommended ;)

    print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

      Everything Utilitarian says is true about what's needed to get a web server (Apache, which I concur is most excellent) running to server up Perl CGI code. However, if you want to get started very quickly and avoid any configuration, might I suggest XAMPP to give you a single EXE that you can run to give you web server, Perl, and ready-to-run WAMP (Windows/Apache/MySQL/Perl+PHP) stack.

Re: Running a perl script from a html page
by desemondo (Hermit) on Dec 10, 2009 at 09:14 UTC
    sounds like you need to tell your webserver that your script needs executable permissions. this varies a bit depending on your webserver...

    IIS - (see step 3)
      Can you please help as to how to set this web server permissions.

        Did you read the links provided? You've not told us what webserver you are using (IIS, Apache or something else?). For Apache see Setting up Perl/CGI with Windows from the tutorials section. For IIS read the link above or check out the IIS documentation.

Re: Running a perl script from a html page
by Anonymous Monk on Dec 10, 2009 at 09:24 UTC
    D:\workspace\ is not a URL, so a webserver would never try to execute it.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://812125]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-05-28 10:53 GMT
Find Nodes?
    Voting Booth?