# Script to convert an HTML page to Perl print # # Reads an HTML file name from STDIN, open the file as input and # # writes to a file of the same name plus 1 with the extension .pl # # # # For example page.html becomes page1.pl and you can test if the # # conversion went OK by typing page1.pl -- you may need to escape # # quotes (the most frequent problem) and others. # #-----------------------------------------------------------------# # by Al Bento (abento@ubmail.ubalt.edu) # #-----------------------------------------------------------------# # get the file name print "Enter the file name\n"; $a = ; chop($a); # create the file name to write the HTML as Perl print ÷ $b = $fname . "1.pl"; # open files open (READ,"$a") || die "Could not open the HTML file\n"; open (WRITE, ">" . $b) || die "could not open file to write\n"; # prepare headers print WRITE "require \"cgi-lib.pl\";\n"; print WRITE "print &PrintHeader;\n"; # reading from the HTML file and writing to the PL file while () {chop; print WRITE "print\" $_\\n\"; \n"; } print "\n"; print "$a, $b\n"; print "\n"; close (READ); close (WRITE); sub divide { ($fname,$ext) = split (/\./,$a); $name =~ s/\W.*//; $ext =~ s/\W.*//; }