4 unless(grep /blib/, @INC) {
10 select(STDERR); $| = 1;
11 select(STDOUT); $| = 1;
17 my $sel = new IO::Select(\*STDIN);
18 $sel->add(4, 5) == 2 or print "not ";
21 $sel->add([\*STDOUT, 'foo']) == 1 or print "not ";
24 @handles = $sel->handles;
25 print "not " unless $sel->count == 4 && @handles == 4;
27 #print $sel->as_string, "\n";
29 $sel->remove(\*STDIN) == 1 or print "not ";
32 $sel->remove(\*STDIN, 5, 6) == 1 # two of there are not present
36 print "not " unless $sel->count == 2;
38 #print $sel->as_string, "\n";
41 print "not " unless $sel->count == 0 && !defined($sel->bits);
44 $sel = new IO::Select;
45 print "not " unless $sel->count == 0 && !defined($sel->bits);
48 $sel->remove([\*STDOUT, 5]);
49 print "not " unless $sel->count == 0 && !defined($sel->bits);
52 if ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'dos') { # 4-arg select is only valid on sockets
53 print "# skipping tests 10..15\n";
54 for (10 .. 15) { print "ok $_\n" }
55 $sel->add(\*STDOUT); # update
59 @a = $sel->can_read(); # should return imediately
60 print "not " unless @a == 0;
63 # we assume that we can write to STDOUT :-)
64 $sel->add([\*STDOUT, "ok 12\n"]);
67 print "not " unless @a == 1;
70 my($fd, $msg) = @{shift @a};
73 $sel->add(\*STDOUT); # update
75 @a = IO::Select::select(undef, $sel, undef, 1);
76 print "not " unless @a == 3;
81 print "not " unless @$r == 0 && @$w == 1 && @$e == 0;
88 # Test new exists() method
89 $sel->exists(\*STDIN) and print "not ";
92 ($sel->exists(0) || $sel->exists([\*STDERR])) and print "not ";
95 $fd = $sel->exists(\*STDOUT);
102 $fd = $sel->exists([1, 'foo']);
110 $sel->add(5,6,7,8,9,10);
111 print "not " unless $sel->count == 7;
114 $sel->remove($sel->handles);
115 print "not " unless $sel->count == 0 && !defined($sel->bits);
119 $SIG{__WARN__} = sub {
121 if $_[0] =~ /^Call to deprecated method 'has_error', use 'has_exception'/
124 IO::Select::has_error();
125 print "not " unless $w == 0 ;
128 use warnings 'IO::Select' ;
129 IO::Select::has_error();
130 print "not " unless $w == 1 ;