Doh! So it should really be this:
if ( (($LAST_CHECKED_AT + $WATCH_DELAY) < time()){
$LAST_CHECKED_AT = time();
if ($LAST_CHANGED_AT < (stat($FILE_TO_WATCH))[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 1:43:58 AM W. Europe Daylight Time,
> ke...@go... writes:
>
>
>> $LAST_CHECKED_AT is being reset, but only when the file is actually
>> checked.
>
>
>
> Let's assume that the file never changes. At first, you're gonna wait
> $WATCH_DELAY seconds. Once that is over, you're going to run the check, but
>
> $LAST_CHANGED_AT < (stat($FILE_TO_WATCH))[9]
>
> evaluates to false, the if-body isn't executed, $LAST_CHECKED_AT not
> being reset. And with the next (and all of the following) calls, you're
> gonna run stat() again, right?
>
> -- Mike
>
> Mike Schilli
> log...@pe...
> http://perlmeister.com
--
Happy Trails . . .
Kevin M. Goess
(and Anne and Frank)
904 Carmel Ave.
Albany, CA 94706
(510) 525-5217
|