Each die or warn will be preceded by the timestamp and the process ID on each line of the output.
$SIG{__WARN__} = sub { my $message = shift; my $prefix = "[$$] [".localtime()."] "; $message =~ s/^/$prefix/gm; warn $message; }; $SIG{__DIE__} = sub { my $message = shift; my $prefix = "[$$] [".localtime()."] "; $message =~ s/^/$prefix/gm; die $message; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Timestamping your warns and dies
by Adam (Vicar) on Sep 13, 2000 at 23:50 UTC | |
|
RE: Timestamping your warns and dies
by fundflow (Chaplain) on Sep 14, 2000 at 05:46 UTC | |
by merlyn (Sage) on Sep 14, 2000 at 06:19 UTC |