File: group.t

package info (click to toggle)
libevent-perl 1.15-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 792 kB
  • sloc: ansic: 3,034; perl: 1,128; makefile: 2
file content (25 lines) | stat: -rw-r--r-- 571 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl -w

use strict;
use Test; plan test => 6;
use Event qw(time);
require Event::group;

my $g = Event->group(parked=>1, timeout => 1.95, cb => sub {
			 my $e = shift;
			 warn "timeout at ".$e->w->cbtime;
		     },
		     add => Event->timer(desc => '1', interval => 2,
					 cb => sub {
					     my $e = shift;
					     warn "boink #1 at ".$e->w->cbtime
					 }),
		     add => Event->timer(desc => '2', interval => 2.5,
					 cb => sub {
					     my $e = shift;
					     warn "boink #2 at ".$e->w->cbtime
					 }),
		    );
$g->start;

Event::loop();