+sub error {
+ my ($error, $type) = @_;
+ if (not defined $type or $type < 100) {
+ PLP::sendheaders unless $PLP::sentheaders;
+ $error =~ s/([<&>])/'&#' . ord($1) . ';'/ge;
+ print qq{<table border=1 class="PLPerror"><tr><td>},
+ qq{<span><b>Debug information:</b><BR>$error</td></tr></table>};
+ } else {
+ select STDOUT;
+ my ($short, $long) = @{ +{
+ 404 => [ 'Not Found', "The requested URL $ENV{REQUEST_URI} was not found on this server." ],
+ 403 => [ 'Forbidden', "You don't have permission to access $ENV{REQUEST_URI} on this server." ],
+ }->{$type} };
+ print "Status: $type\nContent-Type: text/html\n\n",
+ qq{<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n},
+ "<html><head>\n<title>--$type $short</title>\n</head></body>\n",
+ "<h1>$short</h1>\n$long<p>\n<hr>\n$ENV{SERVER_SIGNATURE}</body></html>";
+ }
+}
+