You haven't said which O/S you are running on and that might well have an impact here.

elseif ($signal_num != 0)

That isn't Perl, so either the code you are showing isn't the code you are running or your code isn't running at all.

The upper 8 bits had an exit code of 139, which indicates a seg fault, but the signal for seg fault was not set.

An exit code of 139 does not necessarily indicate a seg fault. Trivially:

#!/usr/bin/env perl use strict; use warnings; system ('perl -e "exit 139"'); my $exit_value = $? >> 8; my $signal_num = $? & 127; my $dumped_core = $? & 128; print <<EOT Exit value: $exit_value Signal: $signal_num Core: $dumped_core EOT
Is there a module or library I can use to automatically catch all of the "bad" return values so I don't have to code all of the enumerations of signals and return values myself?

Unlikely because your idea of "bad" may not be someone else's idea of "bad". However, you could simply write your own module for your own use and then use that in all your other code.


🦛


In reply to Re: Help checking program return values by hippo
in thread Help checking program return values by Special_K

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.