Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Hi doo_the_dew,

For anything complex, Template::Toolkit is very useful, as has already been mentioned.

If it's something simple you can of course just use a perl CGI script as long as your server is configured to support it. On my server, as an example, I created these 3 files:

# head.html <head style="background:cyan"> <style type="text/css"> body { background: cyan; } </style> </head>

and

# body.html <body> <center> <h1>Simple CGI Example for <a href="http://perlmonks.com/?node_id= +1006655">doo_the_dew</a> </center> <hr>
and the file "index.cgi" (make sure it is executable if you're on a Unix/Linux server of course):
#!/usr/bin/perl -w # Libraries use strict; use warnings; use CGI::Carp qw{ fatalsToBrowser }; use IO::File; # IMPORTANT -- CGI scripts need to provide the header print "Content-type: text/html\n\n"; # Main program insert_file("head.html"); # Insert common header insert_file("body.html"); # Insert common body start # # YOUR CODE HERE # # Subroutines sub insert_file { my ($fn) = @_; my $fh = new IO::File; open($fh, "<", $fn) or die "Can't read file '$fn' ($!)\n"; foreach (<$fh>) { print; } close $fh; }

Hopefully that gives you something you can get up-and-running quickly. Once you need more power, you can always add Template::Toolkit, or even create your own HTML-generating libraries, as you desire.

say  substr+lc crypt(qw $i3 SI$),4,5

In reply to Re: Perl and HTML by golux
in thread Perl and HTML by doo_the_dew

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others making s'mores by the fire in the courtyard of the Monastery: (5)
    As of 2014-07-29 06:53 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      My favorite superfluous repetitious redundant duplicative phrase is:









      Results (211 votes), past polls