Listing 3. CGI Program for Including Files
#!/usr/bin/perl -w
use strict;
use diagnostics;
use CGI; # Available from
#http://www.perl.com/CPAN
# Create an instance of CGI
my $query = new CGI;
# Send an accurate content"type
print $query->header("text/html");
print $query->start_html(-title => "Title");
my $fragdir = "/home/httpd/html/fragments";
print &include_file("$fragdir/header.htmlf");
print
"<P>This sentence is preceded by the header,";
print " and followed by the footer.</P>\n";
print &include_file("$fragdir/footer.htmlf");
print $query->end_html;
Copyright © 1994 - 2019 Linux Journal. All rights reserved.