Personally, I find your commenting style to be extremely redundant.

I could see more sense in them if you use abbreviated or otherwise possibly confusing variable names, but as they are now your comments just restate the obvious.

The script also feels unecessarily bulky because of the way you declare now and assign later, something many do only if the variable is set in a less-simple fashion (ie, iteratively built, passed through eval).

Taking both of those into consideration, here's how I'd rewrite your script (untested ;)), taking the liberty to roll in some flexibility via Getopt::Long...

#!/usr/bin/perl -w use strict; use Getopt::Long qw/ GetOptions /; # Default variables my %config = ( 'author' => 'me', # Does 'char_set' have to be the same as # 'encoding' in 'page_specs'? 'char_set' => 'iso-8859-1', 'pagetitle' => 'put-your-title-here', # ... ); # Allow user to override any of the %config # defaults by invoking the script with switches # in the form of --variable='new value' GetOptions( \%config, map { "$_=s" } keys %config, ); # Spit out the page print <<XHTML; <?xml version="$config{'xml_version'}" encoding="$config{'encoding'}"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; chartset=$config{'char_set'}" /> <meta name="author" content="$config{'author'}" /> ... XHTML

    --k.



In reply to Re: Making a 'blank' xhtml page - request for comments by Kanji
in thread Making a 'blank' xhtml page - request for comments by func

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!
  • 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, details, 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, summary, 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.