Index: ossp-pkg/quos/quos.cgi RCS File: /v/ossp/cvs/ossp-pkg/quos/quos.cgi,v rcsdiff -q -kk '-r1.5' '-r1.6' -u '/v/ossp/cvs/ossp-pkg/quos/quos.cgi,v' 2>/dev/null --- quos.cgi 2004/10/27 16:23:46 1.5 +++ quos.cgi 2004/10/28 12:00:26 1.6 @@ -30,6 +30,98 @@ use String::Divert; use IO::File; +# internal handling of fatal errors +BEGIN { + $SIG{__DIE__} = sub { + my ($msg) = @_; + my $hint = ''; + if ($msg =~ m|line\s+(\d+)|) { + my $line = $1; + my $io = new IO::File "<$0"; + my @code = $io->getlines(); + $io->close(); + my $i = -1; + $hint = join("", map { s/^/sprintf("%d: ", $line+$i++)/se; $_; } @code[$line-2..$line]); + } + print STDOUT + "Content-Type: text/html; charset=ISO-8859-1\n" . + "\n" . + "\n" . + "
\n" . + "\n" .
+ " \n" .
+ " $msg
\n" .
+ " \n" .
+ "
\n$hint\n" . + "