I have a command line script that I wrote that includes a whole pile of other Perl libraries that were written in house, many of which are old, krufty, etc. While this is in fact a command line script, our primary environment is the web, and so I am suspicious that my problem is the result of people making assumptions about where the code would be called. So, my problem... My script does a healthy amount of error checking and dies with appropriate error messages. What I would expect to see is something of the form...

ERROR: User is a moron. Please step away from the keyboard. at /path/ +to/offending/file line 42

but instead I get something of the form...

[Wed Aug 6 11:48:17 2003] scriptname: ERROR: User is a moron. Please + step away from the keyboard. at /path/to/offending/file at line 42

I don't want this behavior because it makes things really cluttered. Even more annoying is if you trap and propagate errors then it sticks this extra junk on at each level making a huge mess of things. I added the following line of code both to the offending script which includes boatloads of libraries, as well as to some other script that does not include any such libraries and simply dies for the heck of it...

print "keys: " . join(',', keys(%SIG)), "\n";

This yielded a whole bunch of handlers in the bare bones script...

keys: ABRT,ALRM,BUS,CANCEL,CHLD,CLD,CONT,EMT,FPE,FREEZE,HUP,ILL,INT,IO +,IOT,KILL,LOST,LWP,NUM39,NUM40,NUM41,NUM42,NUM43,NUM44,PIPE,POLL,PROF +,PWR,QUIT,RTMAX,RTMIN,SEGV,STOP,SYS,TERM,THAW,TRAP,TSTP,TTIN,TTOU,URG +,USR1,USR2,VTALRM,WAITING,WINCH,XCPU,XFSZ,__WARN__

The other, real script gave the following...

keys: ABRT,ALRM,BUS,CANCEL,CHLD,CLD,CONT,EMT,FPE,FREEZE,HUP,ILL,INT,IO +,IOT,KILL,LOST,LWP,NUM39,NUM40,NUM41,NUM42,NUM43,NUM44,PIPE,POLL,PROF +,PWR,QUIT,RTMAX,RTMIN,SEGV,STOP,SYS,TERM,THAW,TRAP,TSTP,TTIN,TTOU,URG +,USR1,USR2,VTALRM,WAITING,WINCH,XCPU,XFSZ,__DIE__,__WARN__

It would seem that the difference between the two is the __DIE__ handler that some library, somewhere has gone and installed unbeknowst to me. I verified this by adding the following line to my script...

undef $SIG{__DIE__};

This got my code to die with an appropriately formatted message, but it seems a little krufty to do that, and I'd really like to know from whence the coderef that is in $SIG{__DIE__} has sprung. I could probably accomplish this, with some effort, by using some code introspection libraries. I am wondering though, is this a common effect of some well known library or other? I perldoc'd Carp and didn't get any leads from there.


In reply to UADH: Unidentified Annoying Die Handler by skyknight

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.