common: early setup of plp error formatting
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 27 Apr 2017 01:20:59 +0000 (03:20 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 29 May 2017 17:09:01 +0000 (19:09 +0200)
Load at BEGIN to catch compile-time errors.

common.inc.plp

index 6b45e50042d6bb5f5f52420198905e2f41ac53db..d7e2b7936e2674f2b13c8abf507319d9ead36f4c 100644 (file)
@@ -20,15 +20,15 @@ sub Alert {
        say "<div class=error>$body</div>\n";
 }
 
        say "<div class=error>$body</div>\n";
 }
 
-$PLP::ERROR = sub {
-       my ($text, $html) = @_;
-       Alert("<strong>Fatal error</strong>: $html.");
-       warn $text;
-};
-
 BEGIN {
        require Time::HiRes;
        our $Time = [Time::HiRes::gettimeofday()];
 BEGIN {
        require Time::HiRes;
        our $Time = [Time::HiRes::gettimeofday()];
+
+       $PLP::ERROR = sub {
+               my ($text, $html) = @_;
+               warn $text;
+               Alert("<strong>Fatal error</strong>: $html.");
+       };
 }
 
 # user request
 }
 
 # user request