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 6b45e50..d7e2b79 100644 (file)
@@ -20,15 +20,15 @@ sub Alert {
        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()];
+
+       $PLP::ERROR = sub {
+               my ($text, $html) = @_;
+               warn $text;
+               Alert("<strong>Fatal error</strong>: $html.");
+       };
 }
 
 # user request