@timerchain = ();
$notimers = 0;
+use vars qw($VERSION $BRANCH);
+$VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
+$BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0;
+$main::build += $VERSION;
+$main::branch += $BRANCH;
+
sub new
{
my ($pkg, $time, $proc, $recur) = @_;
$self->{interval} = $time if $recur;
push @timerchain, $self;
$notimers++;
- dbg('connll', "Timer created ($notimers)");
+ dbg("Timer created ($notimers)") if isdbg('connll');
return $self;
}
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;