今天在WINDOWS下用SOCKET時發現如下錯誤:(LINUX下正常)
Your vendor has not defined Fcntl macro F_GETFL, used at :/Perl/site/lib/IO/Multiplex.pm line 932.
只需要替換Multiplex.pm line 932處函數nonblock:
sub nonblock
{
my $fh = shift;
my $flags = fcntl($fh, F_GETFL, 0)
or die "fcntl F_GETFL: $!\n"
fcntl($fh, F_SETFL, $flags | O_NONBLOCK)
or die "fcntl F_SETFL $!\n"
}
替換為:
use constant WIN32 => $^O =~ /win32/i;
sub nonblock {
my $sock = shift;
if (WIN32) {
my $set_it = "1"
ioctl( $sock, 0x80000000 | (4 << 16) | (ord('f') << 8) | 126, $set_it) || return 0;
} else {
fcntl($sock, F_SETFL, fcntl($sock, F_GETFL, 0) | O_NONBLOCK) || return 0;
}
}
即可。
posted on 2007-10-31 20:40
我愛佳娃 閱讀(1185)
評論(0) 編輯 收藏 所屬分類:
Perl