Subj : posix strftime To : Maurice Kinal From : tony summerfelt Date : Wed Feb 23 2005 06:54 pm # On Tue, Feb 22/05 at 01:35 PM, Maurice Kinal wrote to Johan Billing: MK> Yeppers, the POSIX module is a handy, dandy tool to have onboard. I MK> think it's a keeper. i've been using the posix module for a max style logging routine for ages... ================================================================= use POSIX qw(strftime); $newsession=1; $log="test.log"; sub logmsg #{{{ { $stime= strftime("%d %b %H:%M:%S -- ", localtime(time)); $_="@_"; if (/^[\+\:\-\?\!\$\#]/) { $prefix= "$& "; $msg=$'; $msg=~s/^\s+//; } else { $prefix= " "; $msg=$_; } $msg="$prefix".$stime.$msg; open elog, ">>$log" || die "can't open $log - $!"; print elog "\n" if $newsession; $newsession=0 if $newsession; print elog "$msg\n"; close elog; } #}}} logmsg("! errog msg"); logmsg("? warning msg); logmsg("testing blank"); ..t .... telnet://ventedspleen.dyndns.org --- GoldED/spleen 3.0.1+ * Origin: ventedspleen.dyndns.org (1:249/100) .