AE-AdHoc

 view release on metacpan or  search on metacpan

t/20-ae_action.t  view on Meta::CPAN

#!/usr/bin/perl -w

use strict;
use Test::More tests => 5;
use Test::Exception;

use AE::AdHoc;

my @res;
ae_recv {
	ae_action { push @res, @_ } after=>0.03, interval =>0.1;
} soft_timeout=>0.2;

is_deeply (\@res, [ 0, 1 ], "Timer fired twice");

my $x;
ae_recv {
	ae_action { $x++ };
	ok (!$x, "Action didn't work yet");
} soft_timeout=>0.2;

is ($x, 1, "Action w/o parameters works (finally)");
is_deeply (\@res, [ 0, 1 ], "Timer *still* fired twice");

is_deeply (\@AE::AdHoc::errors, [], "No errors in this test");

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.641 second using v1.00-cache-2.02-grep-82fe00e-cpan-f73e49a70403 )