in reply to db2html
Of course, you can always turn off JavaScript, and maybe you never intended to use the script on untrusted data, but IMO, it's never too early to think about security. Plus, as it stands the script doesn't handle ampersands and angle brackets properly. Why not just write the data to stdout (avoiding the filename issue) and use CGI.pm to format/escape the HTML?
#!/usr/bin/perl -w use strict ; use CGI qw (:standard *table) ; die "Usage: $0 <input-filename-list>\n" unless @ARGV ; binmode STDOUT, ':crlf' ; print start_html (-title => join ('; ', @ARGV)), start_table, "\n" ; while (<>) { tr/\r\n//d ; my @cols = map {escapeHTML ($_)} split '\|' ; print TR (td ([@cols])), "\n" ; } print end_table, end_html ;
I admit the output doesn't look as pretty as your nice hand-formatted output though.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: db2html
by straywalrus (Friar) on Oct 30, 2001 at 05:41 UTC |