func has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I've been working on a script that will print out the tags and meta tags I would usually write in a xhtml page before I begin to write out the page's content.
I would appreciate your comments/criticism on the script.
Thanks for your time
The script:
Edit kudra, 2002-04-16 Added readmore#!/usr/bin/perl -w # Program: ~/bin/newxhtmlpage # Syntax: newxhtmlpage [> yourpagename.html] # Modules: use strict; page_specs (); page_head (); page_body (); sub page_specs { # The document's specifications # Variables: my $xml_version; # xml version my $encoding; # encoding to use $encoding="iso-8859-1"; $xml_version="1.0"; print <<XHTMLSPECS; <?xml version="$xml_version" encoding="$encoding"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> XHTMLSPECS } sub page_head { # The head area of the web page # Variables: my $pagetitle; # page's title my $author; # author's name my $copyright_holder; # the copyright holder my $chartset; # character set # Does $chartset have to be the same as # $encoding in page_specs? my $default_keywords; my $default_description; # Variable defaults: $pagetitle="PUT-YOUR-TITLE-HERE"; $author="mynamehere"; $copyright_holder=$author; $chartset="iso-8859-1"; $default_keywords=""; $default_description=""; print <<XHTMLHEAD; <head> <meta http-equiv="Content-Type" content="text/html; chartset=$chartset" /> <meta name="author" content="$author" /> <meta name="copyright" content="$copyright_holder" /> <meta name="keywords" content="$default_keywords" /> <meta name="description" content="$default_description" /> <title>$pagetitle</title> </head> XHTMLHEAD } sub page_body { # The body area and closing tag print <<XHTMLBODY; <body> </body> </html> } # End
|
|---|