I'd like to setup customised exception handling, but am unsure
how to impliment it. I started by reading `perldoc -f die` and
went from there, but the explanation of what I want to do is a
bit over my head. So, I'm looking for pointers, code, favoured
modules, and/or more suggested reading material that's targetted
for an intermediate level reader.

What I hoped to have happen is that if a particular sub returns
empty, undef, or void, I will have it trigger the following sub.
What I'm unsure of, is how to get the die_msg/<STDERR> to pass
to Die_Mail().

Return_Something() || Die_Mail($mail_prog,$admin_email,'???');

sub Die_Mail {
    $mail_prog  = shift || return;
    $admin_email= shift || return;
    $die_msg    = shift || return; # maybe a ref, but basics 1st
    open(OUT,"|$mail_prog") || return;
    print OUT "From: '$0' <[EMAIL PROTECTED]>\n",
              "To: $admin_email\n",
              "Subject: A CGI DIED!\n\n",
              $die_msg;
    close(OUT);
    User_HTML_Warning(); # print a default error page for users
    return true;
}

-- 
=====================
 Shaun Fryer
=====================
 http://sourcery.ca/
 ph: 905-529-0591
=====================

Science is like sex: occasionally something useful
comes out of it, but that's not why we do it.
-: Richard Feynmann

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to