merged back NEW_ROUTE into trunk
[spider.git] / perl / Timer.pm
index 0c44278e05067723a8d0a5e25df430af2ada801c..683497d2d328f889f6d1ac6f1aaf9538587b3a4a 100644 (file)
@@ -25,7 +25,7 @@ sub new
        $self->{interval} = $time if $recur;
        push @timerchain, $self;
        $notimers++;
-       dbg('connll', "Timer created ($notimers)");
+       dbg("Timer created ($notimers)") if isdbg('connll');
        return $self;
 }
 
@@ -41,17 +41,18 @@ sub handler
        my $now = time;
        
        # handle things on the timer chain
-       for (@timerchain) {
-               if ($now >= $_->{t}) {
-                       &{$_->{proc}}();
-                       $_->{t} = $now + $_->{interval} if exists $_->{interval};
+       my $t;
+       foreach $t (@timerchain) {
+               if ($now >= $t->{t}) {
+                       &{$t->{proc}}();
+                       $t->{t} = $now + $t->{interval} if exists $t->{interval};
                }
        }
 }
 
 sub DESTROY
 {
-       dbg('connll', "Timer destroyed ($notimers)");
-       $notimers--;
+       dbg("timer destroyed ($Timer::notimers)") if isdbg('connll');
+       $Timer::notimers--;
 }
 1;