[Dub-pm] Time::Piece && while loops

Andrew Barnes abarnes+dublin-pm at mosina.com.au
Wed May 5 15:51:31 CDT 2004


Hiya Guys

OK, as here's the thing I'm trying to do (sorry to repeat on ya DoC ;>)

I'm working on a script that will write out TCP connection information
into a log file (let's call it $logfile ;>)  Let's say that

$date = yymmdd;
$logfile = <hostname>.yymmdd-hhmmss.txt;

where the time info is of course substituted with the actual numeric
values of course ;>

What I want this script to do is keep writing out the connection info into
this same file *until* the day changes - ala "automated log rotation" ;>

SOooo... when talking to Doc on IRC last night we discussed using a while
loop to do this.  My catch is trying to work out the "best way"
(programatically, as well as "resource-wise") to do this - ie. check the
day, and while $date != $date + 1, write into the log file - otherwise,
update $date, $logfile, and write into the new file

I hope that this makes sense, and look forward to hearing the various
answers/suggestions :-)

Regards,
  Andrew

-- 
Andrew Barnes
Dublin Perl Mongers
W: http://dublin.pm.org
M: andrewbarnes at ramsesit.com
M: +353873803633
PGP Fingerprint: 2C8E E948 C62D 8C2C 48E3 0925 6ED3 78AA 5B17 6E26



More information about the Dublin-pm mailing list