in reply to Perl module to get warn or die to render as HTML
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.
|
|---|