Subject: | ->mask_add can't initialise a new filehandle |
See attached.
--
Paul Evans
Subject: | io-ppoll.txt |
#!/usr/bin/perl
# mask_add bug
use IO::Ppoll qw( POLLOUT );
use IO::Socket;
use strict;
use warnings;
my $s = IO::Socket::INET->new(Proto => 'udp',
LocalPort => 6665,
PeerAddr => 'localhost:6667',
Reuse => 1) or die $@;
my $poll = IO::Ppoll->new;
# ERROR HERE - uncomment one or the other - both should do the same
$poll->mask_add($s => POLLOUT); # this one FAILS
#$poll->mask($s => $poll->mask($s) | POLLOUT ); # this one WORKS
$poll->poll;
for my $fh ( $poll->handles(POLLOUT) )
{
defined $fh or die "undefined file handle returned, should never happen";
}
print "OK\n";