How about adding use MyModuleWhichExports_die; where MyModuleWhichExports_die exports a custom sub die { } which does whatever you need it to do?

Thanks for that. I did not realize you could overwrite Perl's built-in functions that way. This is pretty much what I am looking for.

Quick (possibly dumb)question:
Is it possible to inline MyModuleWhichExports_die in the main program and have it "export" the custom die() function?
e.g.:

package MyModuleWhichExports_die; # Something like Export's "@EXPORT" list here sub die { CORE::die "New and improved!: @_"; } package main; die "I want to be prefixed with 'New and improved'";

I know I can do that by using the fully qualified name of my custom die() (MyModuleWhichExports_die::die), but that defeats the whole purpose of writing a wrapper so I don't have to change my original die() calls in the code


In reply to Re^2: YAML, $SIG{__DIE__}, Log4perl, $^S, and eval{} by ateague
in thread [SOLVED] YAML, $SIG{__DIE__}, Log4perl, $^S, and eval{} by ateague

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.