note
hv
<p>I wonder if <c>$SIG{__DIE__}</c> is exactly the problem here: the line in Math::BigInt::objectify() is:</p>
<c>$k->can('as_number') ? $k = $k->as_number : $k = $a[0]->new($k);</c>
<p>Now, there is a precedence error here (I've reported that), but if can() returns false it shouldn't affect us, it should simply call <c>$a[0]->new($k)</c>.</p>
<p>The code from Math::Pari::can() is:</p>
<c>$f = eval { loadPari($meth) };
return $f if defined $f;
return;</c>
<p>.. which should correctly return undef if the loadPari() fails. However if some <c>$SIG{__DIE__}</c> is catching the loadPari() failure, maybe we're never getting to return from the eval. Or maybe the die handler is (inappropriately) reporting the error and the code is then successfully continuing.</p>
<p>I'd be tempted for starters to put a diagnostic in objectify() just after that line, to see if a) it reaches there, and b) $k has the correct value. I'd also hunt for a <c>$SIG{__DIE__}</c> handler, to check what exactly it is doing - generally, such handlers should almost always act only after checking they are not inside an eval. There may be a better way, but when I needed this some time ago for a logging module the code looked like this:</p>
<c>$SIG{__DIE__} = sub {
# propagate the die if we're under an eval
(defined($^S) && !$^S) or die(@_);
# now do the real stuff
...
};</c>
<p>.. but there may be a better way.</p>
<p>Hugo</p>
508175
809457