
Keep It Simple, Stupid

how can I put together my html code and perl script?

( #43365=categorized question: print w/ replies, xml ) Need Help??
Contributed by Anonymous Monk on Nov 26, 2000 at 17:00 UTC
Q&A  > HTTP and FTP clients

Answer: how can I put together my html code and perl script?
contributed by jreades

There are several different alternatives, and the correct answer depends on your needs and capabilities. Off the top of my head I can think of:

  1. HTML::Mason -- for a full Perl-based solution I'd have trouble believing there's a better system out there. Mason requires mod_perl and a good ten to fifteen modules to run correctly, but is well worth the effort. Aside from the more traditional ASP-style embedded Perl (using <% an_expression %>), the Mason development team has recently added object-like features and autohandlers that enable you to thoroughly seperate formatting from content and make the system more JSP-like (not a big deal if you only have to maintain five to twenty pages, but a life saver if you have to maintain five or fifty times that amount). I'm a huge fan of this system and you can see what I've been up to here. For reference, here's the home page code, the entire page, and you can check it against the source in the browser to see what kind of advantages we're talking about in terms of maintainability and ease of updating (e.g. allowing someone else to do without worrying that they'll break everything):
    <table border="0" cellpadding="3" cellspacing="4"> <tr> <td colspan="2"><h2><font color="FF9933">Latest Company News</ +font></h2></td> </tr> <& /utils/press/last_releases, last=>2, get=>'press' &> </table> <br> <p>Cyber Dialogue is the leading Analytical eCRM provider.<snip></p> <p>Cyber Dialogue's fully hosted solution<snip></p> <%attr> type => 'index' windowTitle => 'Cyber Dialogue <snip>' pageTitle => '' description => 'Cyber Dialogue <snip>' keywords => 'Cyber Dialogue Inc.<snip>' </%attr>
  2. HTML--Embperl is here and although I haven't played with it at all (read: I am talking out of my a**) I believe that it offers a feature-set similar to what you'd find with an ASP system (e.g. <% embedded_code %>)
  3. Straight CGI or FastCGI -- just use in place of your .html files and dynamically serve whatever you want

And that's just off the top of my head... You might also consider PHP -- I don't think it's as powerful as Perl (especially not for larger scale projects) but it seems to be more readily available if you don't control the box your site's being served on. They copied a lot of their ideas from Perl so it's very easy to pick up after a few quality hours with the manual.

contributed by Ovid

Your question is a bit vague, but I am assuming you're asking the best way to use perl to present HTML documents. Check out Template Toolkit, or the simple (but easier)HTML::Template. Also, you can read through lesson one of my online CGI course which gives simple demonstration of HERE documents.

contributed by t0mas

If your target system is aimed for Apache, the Apache::ASP module lets you embed your perl scripts in html. It uses the ASP object model which gives you request, response, session, application and server objects to use in your code. The Apache::ASP project page can be found here


  • Please read these before you post! —
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • 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 studying the Monastery: (7)
    As of 2014-03-15 16:54 GMT
    Find Nodes?
      Voting Booth?

      Have you used a cryptocurrency?

      Results (319 votes), past polls