[英]Perlbrew cannot run simple scripts IPC::System::Simple required for Fatalised/autodying system()
我是一个新的 perlbrew 用户,因为我希望在 Ubuntu 上升级到 perl 5.30.0。
我已经做好了
perlbrew init
perlbrew install perl-5.30.0
perlbrew switch perl-5.30.0
所以我尝试运行这个测试脚本:
#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use feature 'say';
use autodie ':all';
但这给出了很长的错误
IPC::System::Simple required for Fatalised/autodying system() at /home/con/Scripts/say.pl line 6.
main::BEGIN() called at /home/con/Scripts/say.pl line 6
eval {...} called at /home/con/Scripts/say.pl line 6
BEGIN failed--compilation aborted at /home/con/Scripts/say.pl line 6.
Command exited with non-zero status 2
我认为应该通过 perlbrew 自动加载库(尤其是标准库)? 我怎样才能运行这个简单的脚本?
从autodie我们看到它的记录行为
如果
system
被指定为autodie
的参数,那么它使用IPC::System::Simple
来完成繁重的工作。 有关更多信息,请参阅该模块的说明。
所以确实需要为:all
标签(这意味着system
)安装IPC::System::Simple 。
让我感到好奇的是,核心功能需要非核心模块,而且也很安静(安装时不会抱怨)。
我在非 perlbrew Perl 上遇到完全相同的错误。 在出现致命警告或使用:all
运行时,似乎autodie需要IPC::System::Simple ,但在安装过程中不需要它。
根据@ikegami 的说法,该解决方案对我/home/con/perl5/perlbrew/perls/perl-5.30.0/bin/perl -e'use IPC::System::Simple'; /home/con/perl5/perlbrew/perls/perl-5.30.0/bin/cpan IPC::System::Simple; /home/con/perl5/perlbrew/perls/perl-5.30.0/bin/perl -e'use IPC::System::Simple'
: /home/con/perl5/perlbrew/perls/perl-5.30.0/bin/perl -e'use IPC::System::Simple'; /home/con/perl5/perlbrew/perls/perl-5.30.0/bin/cpan IPC::System::Simple; /home/con/perl5/perlbrew/perls/perl-5.30.0/bin/perl -e'use IPC::System::Simple'
/home/con/perl5/perlbrew/perls/perl-5.30.0/bin/perl -e'use IPC::System::Simple'; /home/con/perl5/perlbrew/perls/perl-5.30.0/bin/cpan IPC::System::Simple; /home/con/perl5/perlbrew/perls/perl-5.30.0/bin/perl -e'use IPC::System::Simple'
当然,对于未来的任何人,这对您来说都会略有不同,因为您的目录可能设置不同,并且用户名不是con
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.