CC: | IT-1286 [...] jira.mensa.de |
Subject: | NetAddr::IP::Util calls my $SIG{__DIE__} handler from within its eval{}s |
E.g.:
$ perl -MCarp::Always -E '$SIG{__DIE__} = sub { say "Handler called:\n@_" }; require NetAddr::IP::Util'
Handler called:
Can't locate auto/NetAddr/IP/InetBase/AF_INET6.al in @INC (@INC contains: lib /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux /usr/local/lib/perl5/site_perl/5.30.0 /usr/local/lib/perl5/5.30.0/x86_64-linux /usr/local/lib/perl5/5.30.0 /etc/perl) at /usr/local/lib/perl5/5.30.0/AutoLoader.pm line 54.
AutoLoader::autoload_sub("NetAddr::IP::InetBase::AF_INET6") called at /usr/local/lib/perl5/5.30.0/AutoLoader.pm line 23
AutoLoader::AUTOLOAD() called at /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux/NetAddr/IP/InetBase.pm line 81
eval {...} called at /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux/NetAddr/IP/InetBase.pm line 81
require NetAddr/IP/InetBase.pm called at /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux/NetAddr/IP/Util.pm line 14
NetAddr::IP::Util::BEGIN() called at /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux/NetAddr/IP/InetBase.pm line 0
eval {...} called at /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux/NetAddr/IP/InetBase.pm line 0
require NetAddr/IP/Util.pm called at -e line 1
Handler called:
Can't locate Socket6.pm in @INC (you may need to install the Socket6 module) (@INC contains: lib /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux /usr/local/lib/perl5/site_perl/5.30.0 /usr/local/lib/perl5/5.30.0/x86_64-linux /usr/local/lib/perl5/5.30.0 /etc/perl) at /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux/NetAddr/IP/InetBase.pm line 85.
Handler called:
Can't locate Socket6.pm in @INC (you may need to install the Socket6 module) (@INC contains: lib /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux /usr/local/lib/perl5/site_perl/5.30.0 /usr/local/lib/perl5/5.30.0/x86_64-linux /usr/local/lib/perl5/5.30.0 /etc/perl) at /usr/local/lib/perl5/site_perl/5.30.0/x86_64-linux/NetAddr/IP/Util.pm line 232.
----
IMHO you should do a "local $SIG{__DIE__}" in all eval{}s to prevent that, compare "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 $@;
Please let me know if you are interested in a patch for this.
Regards
Martin