From 764b595d1f125ff281173d0ac4f49f77a1f04b73 Mon Sep 17 00:00:00 2001 Message-Id: <764b595d1f125ff281173d0ac4f49f77a1f04b73.1746197183.git.mdw@distorted.org.uk> From: Mark Wooding Date: Tue, 24 Dec 2024 13:10:12 +0000 Subject: [PATCH] mason/dhandler: Trap errors from module imports. Organization: Straylight/Edgeware From: Mark Wooding Notice errors from module imports by doing it the hard way in `eval', and actually stop the process if there are problems. --- mason/dhandler | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) 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; -- [mdw]