Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I wonder if $SIG{__DIE__} is exactly the problem here: the line in Math::BigInt::objectify() is:

$k->can('as_number') ? $k = $k->as_number : $k = $a[0]->new($k);

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 $a[0]->new($k).

The code from Math::Pari::can() is:

$f = eval { loadPari($meth) }; return $f if defined $f; return;

.. which should correctly return undef if the loadPari() fails. However if some $SIG{__DIE__} 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.

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 $SIG{__DIE__} 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:

$SIG{__DIE__} = sub { # propagate the die if we're under an eval (defined($^S) && !$^S) or die(@_); # now do the real stuff ... };

.. but there may be a better way.

Hugo


In reply to Re^3: Bug in Math::Pari ? by hv
in thread Bug in Math::Pari ? by SineSwiper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found