X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/15d902acaa8a1fc24f756dcc5788d697a0c69a48..917ba679115b9e3cd7b88f7e5081a1a2503a684e:/common.inc.plp diff --git a/common.inc.plp b/common.inc.plp index 9b61d52..7788049 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -20,6 +20,20 @@ sub Alert { say "
$body
\n"; } +sub Abort { + my ($html, $code, $debug) = @_; + unless ($PLP::sentheaders) { + $header{Status} = $code || 500; + } + elsif ($Dev) { + ref $html eq 'ARRAY' or $html = [$html]; + push @{$html}, "Also failed to set HTTP status $code" + . " after output!"; + } + Alert($html, $debug); + exit; +} + BEGIN { require Time::HiRes; our $Time = [Time::HiRes::gettimeofday()];