in reply to Making a 'blank' xhtml page - request for comments
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Making a 'blank' xhtml page - request for comments
by func (Acolyte) on Apr 15, 2002 at 00:55 UTC |