perl - Expect 模块无法在 perl 中工作

标签 perl

我已经在 Perl 中安装了 Expect 模块,位置为 C:\strawberry\perl\lib。

作为先决条件,我首先在安装 perl 的同一位置安装了 IO-Tty 模块。

现在如果我正在做

use Expect;

抛出错误

Can't locate IO/Pty.pm in @INC (@INC contains: C:/strawberry/perl/site/lib C:/st
rawberry/perl/vendor/lib C:/strawberry/perl/lib .) at C:/strawberry/perl/lib/Exp
ect.pm line 22.
BEGIN failed--compilation aborted at C:/strawberry/perl/lib/Expect.pm line 22.
Compilation failed in require at croak.txt line 1.
BEGIN failed--compilation aborted at croak.txt line 1.

可能的原因是

  1. Perl 正在寻找从 Expect.pm 调用的 IO::Pty 和 IO::Tty 模块。但是当我安装了 IO::Tty 模块时,它有 2 个 pm 文件,名称为 Pty.pm 和 Tty.pm

    package Expect;
    
    use IO::Pty 0.97;       # We need make_slave_controlling_terminal()
    use IO::Tty;
    

但是 perl 正在寻找 IO::Tty 模块。

这是否导致了问题。如果是的话我该如何前进

最佳答案

Expect 在 Windows 下不起作用。

至少这是我在查看 CPAN Resters 结果时的印象。这张表在这里: http://matrix.cpantesters.org/?dist=Expect;maxver=1 表明 Windows 下的 Expect 从来没有 PASS。

此外,Expect 文档讨论了该模块无法与 ActivePerl 一起使用,并建议改用 cygwin: https://metacpan.org/module/RGIERSIG/Expect-1.21/Expect.pod#Can-I-use-this-module-with-ActivePerl-on-Windows 。 我认为 Expect 也不适用于 StrawberryPerl。

关于perl - Expect 模块无法在 perl 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18998270/

相关文章:

perl - 如何分析我的 Perl 程序?

linux - 如何使用 Perl 获取 bash 内置命令

perl 如何打印出具有多个键的散列?

perl - 使用弃用的 $* 重写旧程序

xml - Perl XML::DOM 在文件之间复制节点树

perl - 在这种情况下,Perl 用这个参数来插入什么?

mysql - 为什么 Perl 的 DBI 占位符会因负数 MySQL 查询而中断?

perl - 在 Ubuntu 中从 perl 脚本运行 Tcl(期望)脚本的命令

perl - Perl 中的 my ($variableName) 和 my $variableName 有什么区别?

Perl 获取父文件夹名称