summaryrefslogtreecommitdiff
path: root/lib/IO/Async/Timer
diff options
context:
space:
mode:
authorJonathan Yu <jawnsy@cpan.org>2011-02-14 00:43:11 +0000
committerJonathan Yu <jawnsy@cpan.org>2011-02-14 00:43:11 +0000
commit0bbe6bac13ccfbba21f974962649f55fc7fb1f5a (patch)
tree0562266af06e4a1383664a49d4d1a214f2483ce3 /lib/IO/Async/Timer
parent00f6b02da937898b7395160aac23b6334463f25a (diff)
[svn-upgrade] new version libio-async-perl (0.39)
Diffstat (limited to 'lib/IO/Async/Timer')
-rw-r--r--lib/IO/Async/Timer/Absolute.pm8
-rw-r--r--lib/IO/Async/Timer/Countdown.pm8
-rw-r--r--lib/IO/Async/Timer/Periodic.pm6
3 files changed, 10 insertions, 12 deletions
diff --git a/lib/IO/Async/Timer/Absolute.pm b/lib/IO/Async/Timer/Absolute.pm
index 036291a..95ecb75 100644
--- a/lib/IO/Async/Timer/Absolute.pm
+++ b/lib/IO/Async/Timer/Absolute.pm
@@ -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, 2010 -- leonerd@leonerd.org.uk
+# (C) Paul Evans, 2010-2011 -- leonerd@leonerd.org.uk
package IO::Async::Timer::Absolute;
@@ -9,7 +9,7 @@ use strict;
use warnings;
use base qw( IO::Async::Timer );
-our $VERSION = '0.34';
+our $VERSION = '0.39';
use Carp;
@@ -37,8 +37,6 @@ C<IO::Async::Timer::Absolute> - event callback at a fixed future time
},
);
- $timer->start;
-
$loop->add( $timer );
$loop->loop_forever;
@@ -112,7 +110,7 @@ sub configure
$self->start if !$self->is_running;
}
- if( !$self->{on_expire} and !$self->can( 'on_expire' ) ) {
+ unless( $self->can_event( 'on_expire' ) ) {
croak 'Expected either a on_expire callback or an ->on_expire method';
}
diff --git a/lib/IO/Async/Timer/Countdown.pm b/lib/IO/Async/Timer/Countdown.pm
index 4d435d7..13d881d 100644
--- a/lib/IO/Async/Timer/Countdown.pm
+++ b/lib/IO/Async/Timer/Countdown.pm
@@ -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-2010 -- leonerd@leonerd.org.uk
+# (C) Paul Evans, 2009-2011 -- leonerd@leonerd.org.uk
package IO::Async::Timer::Countdown;
@@ -9,7 +9,7 @@ use strict;
use warnings;
use base qw( IO::Async::Timer );
-our $VERSION = '0.34';
+our $VERSION = '0.39';
use Carp;
@@ -108,7 +108,7 @@ sub configure
$self->{delay} = $delay;
}
- if( !$self->{on_expire} and !$self->can( 'on_expire' ) ) {
+ unless( $self->can_event( 'on_expire' ) ) {
croak 'Expected either a on_expire callback or an ->on_expire method';
}
@@ -191,7 +191,7 @@ For example, to expire an accepted connection after 30 seconds of inactivity:
handle => $newclient,
on_read => sub {
- my ( $self, $buffref, $closed ) = @_;
+ my ( $self, $buffref, $eof ) = @_;
$watchdog->reset;
...
diff --git a/lib/IO/Async/Timer/Periodic.pm b/lib/IO/Async/Timer/Periodic.pm
index 93a326d..e756456 100644
--- a/lib/IO/Async/Timer/Periodic.pm
+++ b/lib/IO/Async/Timer/Periodic.pm
@@ -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-2010 -- leonerd@leonerd.org.uk
+# (C) Paul Evans, 2009-2011 -- leonerd@leonerd.org.uk
package IO::Async::Timer::Periodic;
@@ -9,7 +9,7 @@ use strict;
use warnings;
use base qw( IO::Async::Timer );
-our $VERSION = '0.34';
+our $VERSION = '0.39';
use Carp;
use Scalar::Util qw( weaken );
@@ -107,7 +107,7 @@ sub configure
$self->{interval} = $interval;
}
- if( !$self->{on_tick} and !$self->can( 'on_tick' ) ) {
+ unless( $self->can_event( 'on_tick' ) ) {
croak 'Expected either a on_tick callback or an ->on_tick method';
}