perl - Perl 的 IO::Select 在 Windows 中是否与文件句柄一起使用?

标签 perl

是否 IO::Select在 Windows 中使用文件句柄?

$pid = open $handle, "-|", "$_command" || die "Cannot run $_command";
my $s = IO::Select->new();
$s->add($handle);
$s->add(\*STDIN);
while (1) {
    @ready = $s->can_read(30);
    if (scalar(@ready) > 0) {
    }
    else {
    }
}

我的脚本不断在屏幕上打印一些东西,打开后,命令在后台启动,但 can_read 在 Windows 上总是失败。有什么帮助吗?

最佳答案

查看 PerlMonks thread :

select (the underlying system call used by IO::Select) only works for sockets in Windows.

MSDN docs for select确认:

The select function determines the status of one or more sockets, waiting if necessary, to perform synchronous I/O.

关于perl - Perl 的 IO::Select 在 Windows 中是否与文件句柄一起使用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1700007/

相关文章:

Perl,LWP "certificate verify failed"与 paypal.com

linux - 没有使用 Net::SFTP::Foreign 的非 root 连接

windows - Perl:在新的 cmd.exe 中发出命令

html - 我如何从 Perl 中的 HTML 表格中提取数据?

perl - 如何从 Perl 中的 2 个文件之一删除公共(public)行?

linux - 如何在 Linux 的 Perl 中使用带有 fcgi 的 unix 域套接字的抽象名称?

javascript - 在 perl CGI 中分割 AJAX 响应?

unpack 结合 Perl 中的 join 的性能

perl - 如何在perl中grep方括号

perl - awk:打印一组行中的三行