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

How do you embed a Perl script into an HTML document?

by Anonymous Monk
on Nov 21, 2000 at 21:48 UTC ( [id://42734]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

It has to be a very simple process. I've just started using Perl in school and need to know how to run a Perl script on a web page.

Originally posted as a Categorized Question.

  • Comment on How do you embed a Perl script into an HTML document?

Replies are listed 'Best First'.
Re: How do you embed a Perl script into an HTML document?
by KM (Priest) on Nov 21, 2000 at 21:50 UTC
Re: How do you embed a Perl script into an HTML document?
by a (Friar) on Nov 22, 2000 at 10:50 UTC
    As w/ the 'down off an elephant' joke' you don't, generally. You write perl cgi to produce the web page. But there's more. Mason et alia are ways to do that (there's a perlscript/IIS implant) one of which is covered in the July (alas *not* online) 2000 issue of SysAdmin, which uses perl (and sh/ksh) 'here' documents, apache and the htttpd.conf file to do on-the-fly perl processing. Pretty nice.

    For more on Mason and other options, see perlmonth - a great resource, though it seems to have been' halted at issue 11. ;-<

    a

Re: How do you embed a Perl script into an HTML document?
by nite_man (Deacon) on May 07, 2003 at 13:01 UTC
Re: How do you embed a Perl script into an HTML document?
by damian1301 (Curate) on Nov 22, 2000 at 01:55 UTC
    Well just to start, I got most of this info from "Perl in a Nutshell". First, you have to make sure that it can support ASP. Then to place it in the HTML document use the <script></script> tags Ex:
    <Script language="PerlScript"> $window->document->write("This is PerlScript.."); </script>
Re: How do you embed a Perl script into an HTML document?
by Malkavian (Friar) on Nov 21, 2000 at 21:54 UTC
    From your question, I'd assume you're talking about using CGI.
    For this, check out CGI.pm from CPAN as a programming module. It's very useful.
    If you're not familiar with the process of CGI programming, I'd suggest reading a small book about it, or doing a few searches here.. I'm sure there are a few tutorials on it.
    The basis of CGI is that you have a Perl script on the web server, which is invoked when a browser points to it. The output of the Perl program is the html of the page. Inputs are achieved via forms.
    Well, that's very simplistic, but you'll get the idea searching round.
    Hope this helps some,

    Malk
Re: How do you embed a Perl script into an HTML document?
by snapdragon (Monk) on Apr 18, 2001 at 13:03 UTC
    Considering that you beginning it's probably well worth having a look at Server SIde includes (SSI). SSI's allow HTML files to be written and then have perl scripts embedded in them. Have a look at this quick SSI Tutorial and see what you think.
Re: How do you embed a Perl script into an HTML document?
by Anonymous Monk on Apr 09, 2002 at 23:35 UTC
    i have found that using frames is the best way around it, but if you insist on not using frames, then you could place a hidden html tag eg. at the point where you want your returned code to appear, create a cript that opens your html file (as a template) and reads it into an array, do a foreach loop through the array and if is found on the line, run the required routine then finnish your foreach loop... I hope that makes sense
      So far nothing makes sense to me. I'm using Windows XP. I installed ActivePerl and have PerlScript in my registry. I have tried very simple perl scripts: <%@Language=PerlScript%> <HTML> <TITLE> PerlScript Test </TITLE> <% for($i=0; $i<=10; $i+=2) { $Response->Write(""); $Response->Write("Hello World!
      "); } %> </HTML> I get the following error: Error Type: Active Server Pages, ASP 0129 (0x80004005) The scripting language 'PerlScript' is not found on the server. /PerlScript.asp, line 1 or if the asp file is called from an html file I just get HTTP 500 - Internal server error. I have PERL_SRC in my system variables and PERL in my path but no other PERL refernces. I've tried to read all the PERL documentation but I'm getting nowhere and am ready to throw perl away and use C to access mysql.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://42734]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2024-04-18 13:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found