CC: | IT-957 [...] jira.mensa.de |
Subject: | out $SIG{__DIE__} handlers being called when optional modules are not installed |
$ perl -E '$SIG{__DIE__}=sub{say"Handler called: @_"};require IO::Uncompress::Unzip'
Handler called: Can't locate IO/Uncompress/Adapter/UnLzma.pm in @INC (you may need to install the IO::Uncompress::Adapter::UnLzma module) (@INC contains: /usr/lib/perl5/site_perl/5.26.1/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.26.1 /usr/lib/perl5/vendor_perl/5.26.1/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.26.1 /usr/lib/perl5/5.26.1/x86_64-linux-thread-multi /usr/lib/perl5/5.26.1 /usr/lib/perl5/site_perl) at /usr/lib/perl5/5.26.1/IO/Uncompress/Unzip.pm line 25.
You should IMHO prevent that by locally disabling these handlers; see "perldoc -f eval":
Using the "eval {}" form as an exception trap in libraries
does have some issues. Due to the current arguably broken
state of "__DIE__" hooks, you may wish not to trigger any
"__DIE__" hooks that user code may have installed. You can
use the "local $SIG{__DIE__}" construct for this purpose, as
this example shows:
# a private exception trap for divide-by-zero
eval { local $SIG{'__DIE__'}; $answer = $a / $b; };
warn $@ if $@;
Regards
fany