From: Mark Wooding Date: Tue, 24 Dec 2024 13:10:12 +0000 (+0000) Subject: mason/dhandler: Trap errors from module imports. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/tgal/commitdiff_plain/764b595d1f125ff281173d0ac4f49f77a1f04b73?ds=sidebyside mason/dhandler: Trap errors from module imports. Notice errors from module imports by doing it the hard way in `eval', and actually stop the process if there are problems. --- diff --git a/mason/dhandler b/mason/dhandler index 8c151ba..610a544 100755 --- a/mason/dhandler +++ b/mason/dhandler @@ -434,13 +434,19 @@ Failed to find ‘<% $path |h %>’. % %###------------------------------------------------------------------------- <%once> - use autodie; - use File::stat; + BEGIN { + eval { + require autodie; autodie->import; + require File::stat; File::stat->import; - use TrivGal; + require TrivGal; TrivGal->import; + }; + if ($@) { print "$@"; exit 2; } + } % <%init> + clean_temp_files; TrivGal->init; my $path = $m->dhandler_arg;