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; };
In reply to Timestamping your warns and dies by merlyn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |