in reply to [SOLVED] YAML, $SIG{__DIE__}, Log4perl, $^S, and eval{}

Here are the results of testing Anon and jellisii2's suggestions:
(Sample code used for testing available if needed)

  1. Log4perl qw/:easy/;

    PROS:

    • Easy to implement.

    CONS:

    • (minor) Manual work needed to find and replace all die() calls with LOGDIE
    • Does not catch and log errors in external modules that do not use Log4perl
  2. Export custom die() in Logger.pm

    PROS:

    • Easy to implement.

    CONS:

    • (minor) Extra file to be distributed with script.
    • Does not catch and log errors in external modules that do not use Log4perl
    • Catches die() in an eval
  3. Wrap logging in custom $SIG{__DIE__} handler

    PROS:

    CONS:

Any further suggestions on how I should proceed? I am leaning towards using $SIG{__DIE__} and then testing to see if anything breaks unexpectedly. If things do break, I plan on either installing the missing modules, or if ActiveState does not have them, localising $SIG{__DIE__} and wrapping the offending call in an eval.

  • Comment on Re: YAML, $SIG{__DIE__}, Log4perl, $^S, and eval{}