-- dba dba <[EMAIL PROTECTED]> on 09/25/01 17:03:56 -0400
> For any reason there is an error, perl will exit. Everyday I have to
> read output files to see whether there is an error, how can I make a
> perl call my sub function TRAP_DIE so that when error, I will get an
> email?
> I tried to put the line
eval
{
$your_code_that_dies_here;
};
if( $@ )
{
nastygram $to, $subject, $body; # assuming you have a nastygram sub
that sends email
}
else
{
print "Good news, boss, the code didn't die";
}
if checking for errors:
eval { subroutine_call_here( @argz ) };
if( $@ =~ /ORA-12345/ )
{
DEAL WITH ORA-12345 HERE
}
elsif( $@ =~ /ORA-54321 )
{
YOU GET THE PICTURE
}
else
{
Nothing to deal with since nothing died.
}