To make life easier when creating your web page's html inside of a perl
script, you can make it so that you only have to code your header and footer
html once.
|
To create a header subroutine... |
1). Create a text document and type sub Header { as the
first line.
2). Next, type print "Content-type: text/html\n\n";
. This sets the MIME type of the document.
3). Next, type print "<HTML><HEAD>\n";
4). Next, type print "<TITLE>Enter title Here</TITLE>\n";
5). Next, type print "</HEAD>\n";
6). Next, type print "<BODY BGCOLOR='white'>";
7). Next,
type print "Any other html would go here for header";
8).
Then, type } to end the subroutine
sub
Header {
print
"Content-type: text/html\n\n";
print
"<HTML><HEAD>\n";
print
"<TITLE>Enter title Here</TITLE>\n";
print
"</HEAD>\n";
print
"<BODY BGCOLOR='white'>";
print
"Any other html would go here for header";
} |
|
To create a footer subroutine... |
1).
In the same text document as above type sub Footer { after line space
or two after the sub header routine
2). Next, type print "\n</BODY></HTML>";
3). Next, type } to end the subroutine
sub
Footer {
print
"\n</BODY></HTML>";
} |
|
Note: at the end of your text file, type 1; to complete the
subroutine document... be sure to chmod 644 textdocumentname.lib
as this does not need to be executed |
|
To call your subroutines in a script... |
1).
In your script,
where you normally place require statements, type require "textdocumentname.lib";
2). Later in your script where you wish to call your subroutines appropriately
type &Header; to call your header subroutine and &Footer
for your footer subroutine according to where you wish to place them. |