From: Kevin G. <ke...@go...> - 2002-09-12 00:05:23
|
Damn! Well at least I could tell when I needed the code review. I had looked at that routine so much it looks like Chinese to me. And I couldn't think of a decent way to test or describe the boundary conditions. Shall we go with this?: print "exe_watch_code:\n" if DEBUG; #more closures here if ( ($LAST_CHECKED_AT + $WATCH_DELAY) < time()){ $LAST_CHECKED_AT = time(); if ($LAST_CHANGED_AT < (stat($FILE_TO_WATCH))[9] ){ $LAST_CHANGED_AT = (stat(_))[9]; print " Config file has been modified\n" if DEBUG; #these are now handled by the call to reset() in _init() #%APPENDER_BY_NAME = (); #$DISPATCHER = Log::Dispatch->new(); Log::Log4perl->init_and_watch($FILE_TO_WATCH, $WATCH_DELAY); my $methodname = lc($level); $logger->$methodname($message); # send the message # to the new configuration } return; } Msc...@ao... wrote: > In a message dated 9/11/02 10:00:20 AM Pacific Daylight Time, > ke...@go... writes: > > >> if ( (($LAST_CHECKED_AT + $WATCH_DELAY) < time()){ > > > Yup, and also you need to update LAST_CHANGED_AT (in addition to > LAST_CHECKED_AT) inside the if-body ... > > -- Mike > > Mike Schilli > log...@pe... > http://perlmeister.com > http://log4perl.sourceforge.net -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |