Jay Savage wrote:
Actually, you probably want that to be:
$SIG{__DIE__}=\&log_die;
sub log_die
{
my $time=scalar localtime;
open (HDW,">>",$err_log)
or die "Can't open log file $err_log: $!\nError: "[EMAIL PROTECTED];
print HDW $time," ",@_
or die "Can't write to log file $err_log: $!\n Error: "[EMAIL
PROTECTED];
close HDW;
close HDW or die "cannot close log file $err_log: $!\nError: "[EMAIL
PROTECTED];
# print statements write to a buffer that is not
# written to disk until after the file is close.
die @_;
}
If there's a problem writing to the log file, you want to know about it.
HTH,
-- jay
--
Just my 0.00000002 million dollars worth,
--- Shawn
"For the things we have to learn before we can do them,
we learn by doing them."
Aristotle
"The man who sets out to carry a cat by its tail learns something that
will always be useful and which will never grow dim or doubtful."
Mark Twain
"Believe in the Divine, but paddle away from the rocks."
Hindu Proverb
* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is at http://perldoc.perl.org/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>