Commit | Line | Data |
cf7fe8a2 |
1 | #!./perl |
2 | |
3 | BEGIN { |
4 | unless(grep /blib/, @INC) { |
5 | chdir 't' if -d 't'; |
6 | @INC = '../lib' if -d '../lib'; |
7 | } |
8 | } |
9 | |
10 | select(STDERR); $| = 1; |
11 | select(STDOUT); $| = 1; |
12 | |
13 | print "1..8\n"; |
14 | |
15 | use IO::Handle; |
16 | use IO::Poll qw(/POLL/); |
17 | |
18 | my $poll = new IO::Poll; |
19 | |
20 | my $stdout = \*STDOUT; |
21 | my $dupout = IO::Handle->new_from_fd(fileno($stdout),"w"); |
22 | |
23 | $poll->mask($stdout => POLLOUT); |
24 | |
25 | print "not " |
26 | unless $poll->mask($stdout) == POLLOUT; |
27 | print "ok 1\n"; |
28 | |
29 | $poll->mask($dupout => POLLPRI); |
30 | |
31 | print "not " |
32 | unless $poll->mask($dupout) == POLLPRI; |
33 | print "ok 2\n"; |
34 | |
35 | $poll->poll(0.1); |
36 | |
37 | print "not " |
38 | unless $poll->events($stdout) == POLLOUT; |
39 | print "ok 3\n"; |
40 | |
41 | print "not " |
42 | if $poll->events($dupout); |
43 | print "ok 4\n"; |
44 | |
45 | my @h = $poll->handles; |
46 | print "not " |
47 | unless @h == 2; |
48 | print "ok 5\n"; |
49 | |
50 | $poll->remove($stdout); |
51 | |
52 | @h = $poll->handles; |
53 | |
54 | print "not " |
55 | unless @h == 1; |
56 | print "ok 6\n"; |
57 | |
58 | print "not " |
59 | if $poll->mask($stdout); |
60 | print "ok 7\n"; |
61 | |
62 | $poll->poll(0.1); |
63 | |
64 | print "not " |
65 | if $poll->events($stdout); |
66 | print "ok 8\n"; |