File: group.pm

package info (click to toggle)
libevent-perl 1.06-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 712 kB
  • ctags: 588
  • sloc: ansic: 3,020; perl: 1,128; makefile: 46
file content (30 lines) | stat: -rw-r--r-- 523 bytes parent folder | download | duplicates (9)
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
26
27
28
29
30
use strict;
package Event::group;
use Carp;
use base 'Event::Watcher';
use vars qw(@ATTRIBUTE);

@ATTRIBUTE = qw(timeout);

'Event::Watcher'->register;

sub new {
    my $class = shift;
    my %arg;
    my @add;
    while (my ($k,$v) = splice(@_, 0, 2)) {
	if ($k eq 'add') {
	    push @add, $v;
	} elsif ($k eq 'del') {
	    carp "del in constructor (ignored)";
	} else {
	    $arg{$k} = $v;
	}
    }
    my $o = allocate($class, delete $arg{attach_to} || {});
    $o->init(\%arg);
    $o->add($_) for @add;
    $o;
}

1;