Skip Menu |

This queue is for tickets about the Hash-Util-FieldHash-Compat CPAN distribution.

Report information
The Basics
Id: 83667
Status: resolved
Priority: 0/
Queue: Hash-Util-FieldHash-Compat

People
Owner: ether [...] cpan.org
Requestors: CKEITH [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.03
Fixed in: 0.04



Subject: eval to check for Hash::Util::FieldHash triggers __DIE__ signal handler
I have a signal handler installed for __DIE__. When loading this module it triggers the signal handler because of the eval to determine if Hash::Util::FieldHash is present on the system. H:U:FH is absent on older versions of Perl and this is a problem since this module is used in Data::Printer. Simple fix. USe Local() to set SIGDIE to IGNORE, per the patch.
Subject: Hash_Util_FieldHash_Compat.pm.patch
--- old/Hash_Util_FieldHash_Compat.pm 2013-02-27 15:22:16.000000000 -0500 +++ Hash_Util_FieldHash_Compat.pm 2013-02-27 15:22:21.000000000 -0500 @@ -5,7 +5,7 @@ use strict; use warnings; -use constant REAL_FIELDHASH => do { local $@; eval { require Hash::Util::FieldHash } }; +use constant REAL_FIELDHASH => do { local $@; local($SIG{__DIE__}) = 'IGNORE'; eval { require Hash::Util::FieldHash } }; BEGIN { if ( REAL_FIELDHASH ) {
On 2013-02-27 12:26:44, CKEITH wrote: Show quoted text
> I have a signal handler installed for __DIE__. When loading this module > it triggers the signal handler because of the eval to determine if > Hash::Util::FieldHash is present on the system. > > H:U:FH is absent on older versions of Perl and this is a problem since > this module is used in Data::Printer. > > Simple fix. USe Local() to set SIGDIE to IGNORE, per the patch.
I don't think this is a bug here. You'd be catching every other die inside eval{}s everywhere else in your code, but __DIE__ handlers should only be firing for *uncaught* exceptions. The right thing to do here is to check the value of $^S inside your handler. See 'perldoc perlvar' under $^S, and the last few paragraphs in 'perldoc -f die'. However, I'm mildly moved by seeing that Module::Runtime::use_package_optimistically does localise the handler, so I'll make this change anyway. Will release this weekend.
0.04 released.