$SIG{__DIE__} problem

Discussion in 'Perl' started by bzd, Jan 15, 2004.

  1. bzd

    bzd Guest

    Hello
    I wrote a simple mail filtering script using Mail::Audit. It works
    fine, but I'd like to overload DIE signal handler, so the script
    would not send back "Undelivered Mail Returned to Sender" with
    die output if there are any errors. It should just log exception
    mesg or mail it directly to me.
    I've tried
    $SIG{__DIE__} = sub {
    print LOG "DIE: ".$_[0];
    $incoming_mail->ignore; # for Mail::Audit
    }
    but it doesn't work. $SIG{__DIE__} does work in simple testcase
    though, like opening non-existing file, so I'm probabbly missing
    something. Could anyone help?

    regards,
    artb.
    --
    only so many songs can be sung with two lips two lungs and one tongue
     
    bzd, Jan 15, 2004
    #1
    1. Advertising

  2. bzd

    Guest

    bzd <> wrote in message news:<>...

    > I wrote a simple mail filtering script using Mail::Audit. It works
    > fine, but I'd like to overload DIE signal handler, so the script
    > would not send back "Undelivered Mail Returned to Sender" with
    > die output if there are any errors.


    That does not sound like a good enough reason to use $SIG{__DIE__}.

    For normal everyday execption handing use eval{}.

    $SIG{__DIE__} is only for very special cases where you really need to
    get involved in low-level stuff.

    This newsgroup does not exist (see FAQ). Please do not start threads
    here.
     
    , Jan 20, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. steffen staehle
    Replies:
    0
    Views:
    499
    steffen staehle
    Sep 7, 2004
  2. Devaraj

    Stack Problem: sig 11 maperr

    Devaraj, Sep 6, 2003, in forum: C++
    Replies:
    1
    Views:
    1,220
    Kevin Goodsell
    Sep 6, 2003
  3. matchstick86

    sig : process vs. process(sig)

    matchstick86, Oct 12, 2009, in forum: VHDL
    Replies:
    1
    Views:
    572
    power_hf2005
    Oct 13, 2009
  4. Jo Oberman
    Replies:
    5
    Views:
    234
    Ilya Zakharevich
    Sep 14, 2003
  5. Mark
    Replies:
    9
    Views:
    217
    Ilya Zakharevich
    Sep 30, 2010
Loading...

Share This Page