#!/usr/bin/perl
if (-e "header.html"){
unless (open WEBPAGE, "header.html") {
die "Could not open the file header.html to convert.\n";
}
unless (open JSPAGE, ">header.js") {
die "Was not able to open header.js for editing.\n";
}
while () {
chomp;
print JSPAGE "document.write(\"$_\")\n";
}
print "Header.html was converted and the result saved as \"header.js\"\n";
} else { print "No file \"header.html\" found to convert.\n"; }
if (-e "footer.html") {
unless (open WEBPAGE, "footer.html") {
die "Could not open the file footer.html to convert.\n";
}
unless (open JSPAGE, ">footer.js") {
die "Was not able to open footer.js for editing.\n";
}
while () {
chomp;
print JSPAGE "document.write(\"$_\")\n";
}
print "Footer.html was converted and the result saved as \"footer.js\"\n";
} else { print "No file \"footer.html\" found to convert.\n";}