Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

trying to run a perl program in HTML

by aykes (Initiate)
on Apr 22, 2001 at 23:58 UTC ( #74587=categorized question: print w/replies, xml ) Need Help??
Contributed by aykes on Apr 22, 2001 at 23:58 UTC
Q&A  > HTTP and FTP clients


I have a perl program (running on windows). I want to run it through a webpage (local on my computer). Is the a way for HTML to run 'perl

Answer: trying to run a perl program in HTML
contributed by tinman

You need to install a webserver on your computer.. use IIS, PWS, or even Apache for Win32..

Next, write a HTML form as so..

<form action="" method="post"> <input type="submit" name="sub" value="Run this!"> </form>
on your page..

Inside your CGI script (yes, you've writen a CGI script now), execute the Perl script that you want using exec or system or backticks like so..

#!c:/perl/bin -w use strict; use CGI; my $q = new CGI; my $path_to_program = "c:/perl/myprog/"; my $return_value = system("c:/perl/bin/perl.exe",$path_to_program); # this is the actual execution of the script. # now you can put a message to the user print $q->header; # send correct header, text/html # put HTML here

It might be best if you restrict access to this script to ONLY your machine..

Answer: trying to run a perl program in HTML
contributed by epoptai

You need to set up a webserver with Common Gateway Interface (CGI) to execute perl scripts on your local computer. Meanwhile you can capture the HTML output of a script with something like perl >myprogram.html to view static pages in a browser.

Answer: trying to run a perl program in HTML
contributed by tomhukins

If you use ActivePerl, you can write client side Perl scripts, just as you might write client side Javascript. Be aware of the security implications of doing this: you don't want malicious Web pages to include things like unlink within <SCRIPT> tags, for example.

Please (register and) log in if you wish to add an answer

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (7)
    As of 2020-08-12 16:02 GMT
    Find Nodes?
      Voting Booth?
      Which rocket would you take to Mars?

      Results (66 votes). Check out past polls.