Office.com logo
Industries Run Your Business E-Business News and Research Community On The Air MarketplaceOffice.com top navigation bar
 Search: 
   Search  Search Help Get our free Newsletter
Get free Desktop Toys
Featured Business Services

100 Search Engines, 48 Hours
Save On Hertz Car Rentals
E-Marketing Service Provider
Save up to 70% on computers
Need Full Service Offices?
Hewlett Packard Center
Eliminate Payroll Headache!
Find a Consultant

Web Site for Your Business
Get Broadband Services
Get Clicking with Sprint ION

New user? Click to Register
Returning user? Sign In





Perlaccess : Tutorials : Subroutines
Creating Header & Footer Subroutines (11.4)
by Brett Roberts
http://www.bigresources.com

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.
BigResources Weekly
1-Click-Clipart
Free Clipart Reviews
123 Webmaster
Free Web Tools
A1 Javascripts
Free Java Scripts
Font Files
Free Fonts
Freeware Files
Free Downloads
FreeWebTemplates
Free Website Templates
Fresher Image
Free Clipart
HTML Forums
Free Help
Perl Access
Learn Perl Scripts

 
Free email - Signup Now!

Other Resources
FreebieDirectory.com




Perlaccess.com and all content within this site is copyright © Big Resources, Inc.
Mascot team created by Drawshop.com
Help Contact Us Join Our Team Partners About Us Home
Copyright © 1999-2001 Office.com Inc. All Rights Reserved.
Use of this site is subject to Office.com's Terms of Service.
Office.com's Privacy Policy.