Date: | Tue, 28 Oct 2003 20:16:23 -0800 |
From: | Don Armstrong <don [...] donarmstrong.com> |
To: | bug-POE [...] rt.cpan.org |
Subject: | Alarm status / Setting only one alarm |
Recently, I've found myself wishing for a $kernel->alarm() with the
opposite effect that it has currently.
That is, instead of clearing the previously set alarm and setting a
new one, it only sets a new alarm if one doesn't exist.
I see two ways to go about doing this:
my @alarms = $kernel->alarms('alarm_name');
where @alarms is the list of alarms with the name 'alarm_name' as
returned by $kernel->alarm_remove_all();
Alternatively:
$kernel->alarm_soon('alarm_name',$time);
(Hopefully someone can think of something better than _soon) which
makes sure that 'alarm_name' is scheduled at $time or before.
[Possibly deleting later alarms?]
This is usefull to avoid delaying alarms indefinetly by repeated calls
to $kernel->alarm() or adding useless alarms by calls to
$kernel->alarm_add().
Don Armstrong
--
It seems intuitively obvious to me, which means that it might be wrong
-- Chris Torek
http://www.donarmstrong.com
http://www.anylevel.com
http://rzlab.ucr.edu
Message body not shown because it is not plain text.