Skip Menu |

This queue is for tickets about the IO-Async CPAN distribution.

Report information
The Basics
Id: 75954
Status: resolved
Priority: 0/
Queue: IO-Async

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in:
  • 0.46_002
  • 0.47



Subject: Unable to construct IO::Async::Timer::Countdown with delay==0
$ perl -MIO::Async::Timer::Countdown \ -E 'IO::Async::Timer::Countdown->new( delay => 0, on_expire => sub {} ) Expected a 'delay' as a positive number at -e line 1 This can be a useful thing to do, to achieve a "later"-like ability. -- Paul Evans
Fixed. -- Paul Evans
Subject: rt75954.patch
=== modified file 'lib/IO/Async/Timer/Countdown.pm' --- lib/IO/Async/Timer/Countdown.pm 2012-03-21 12:43:18 +0000 +++ lib/IO/Async/Timer/Countdown.pm 2012-03-21 21:56:21 +0000 @@ -1,7 +1,7 @@ # You may distribute under the terms of either the GNU General Public License # or the Artistic License (the same terms as Perl itself) # -# (C) Paul Evans, 2009-2011 -- leonerd@leonerd.org.uk +# (C) Paul Evans, 2009-2012 -- leonerd@leonerd.org.uk package IO::Async::Timer::Countdown; @@ -77,7 +77,8 @@ =item delay => NUM The delay in seconds after starting the timer until it expires. Cannot be -changed if the timer is running. +changed if the timer is running. A timer with a zero delay expires +"immediately". =item remove_on_expire => BOOL @@ -112,7 +113,7 @@ $self->is_running and croak "Cannot configure 'delay' of a running timer\n"; my $delay = delete $params{delay}; - $delay > 0 or croak "Expected a 'delay' as a positive number"; + $delay >= 0 or croak "Expected a 'delay' as a non-negative number"; $self->{delay} = $delay; }