Re: reusing a timer watcher with different 'at' attribute

[email protected] ((Jochen Stenzel))
Newsgroups perl.loop
Message-ID <[email protected]>
Hello, Raul,

>1 - Create a timer watcher with a high period (e.g. 60)
>2 - Create it parked, so it won't run
>3 - the $watcher->interval; reports 60.
>4 - set it to lower value (e.g. 1) $watcher->interval(1);
>5 - the $watcher->interval; reports 1 (as expected)
>6 - start the watcher $watcher->start;
>7 - the even will occurr just 60s later and not 1s.

I tried it and found it exactly as you said. The first event occurs
after the initial interval, while subsequent events take the new
interval value into account.

Luckily, again() behaves differently: if again() is used instead of
start(), even the first event is recognized correctly. This could be
used as a workaround.

             Jochen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.