in reply to My proudest moment
Something similar I often do in CGI programs and other utilities that are not attached to the terminal:
and then all die and warn messages go to the log file in /tmp.BEGIN { open STDERR, ">", "/tmp/$0-$$.log"; }
To get this to work with Sys::Syslog you would need a little more machinery:
And then everything written to STDERR gets passed along to syslog.BEGIN { sub SLH::PRINT { syslog("err", $_[1]) } sub SLH::TIEHANDLE { return bless ["dummy object"] => "SLH" } tie *STDERR => "SLH"; }
Disclaimer 1: I didn't actually try this.
Disclaimer 2: I never, ever use software written by Eric Allman.
In Section
Meditations