causes a die or a warn to render as nice HTML in a web-browser for debugging purposes
Check this out:
#!/usr/bin/perl -w
use strict;
use CGI qw/ :all /;
$SIG{__DIE__} = \&htmldie;
open FIN,"< some_stupid_nonexistant_file.or.other" or die $!;
my $line=<FIN>;
exit(0);
sub htmldie {
my @args=@_;
print header,start_html,pre(join("\n",@args)),end_html;
exit(0);
}
I found this by doing a quick check of perldoc -f die
which shows this pattern.
Peter L. Berghold -- Unix Professional
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg
|