[英]Perlbrew cannot run simple scripts IPC::System::Simple required for Fatalised/autodying system()
I am a new perlbrew user, as I wish to upgrade to perl 5.30.0 on Ubuntu.我是一个新的 perlbrew 用户,因为我希望在 Ubuntu 上升级到 perl 5.30.0。
I have done我已经做好了
perlbrew init
perlbrew install perl-5.30.0
perlbrew switch perl-5.30.0
so I try to run this test script:所以我尝试运行这个测试脚本:
#!/usr/bin/env perl
use strict;
use warnings FATAL => 'all';
use feature 'say';
use autodie ':all';
but this gives the long error但这给出了很长的错误
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
I thought that libraries (especially standard ones) were supposed to be loaded automatically via perlbrew?我认为应该通过 perlbrew 自动加载库(尤其是标准库)? How can I get this simple script to run?
我怎样才能运行这个简单的脚本?
From autodie we see that it's documented behavior从autodie我们看到它的记录行为
If
system
is specified as an argument toautodie
, then it usesIPC::System::Simple
to do the heavy lifting.如果
system
被指定为autodie
的参数,那么它使用IPC::System::Simple
来完成繁重的工作。 See the description of that module for more information.有关更多信息,请参阅该模块的说明。
So one does need IPC::System::Simple installed for :all
tag (which implies system
).所以确实需要为
:all
标签(这意味着system
)安装IPC::System::Simple 。
It strikes me as curious that a core functionality requires a non-core module, and quietly too (doesn't complain at installation).让我感到好奇的是,核心功能需要非核心模块,而且也很安静(安装时不会抱怨)。
I'm getting exactly the same error on a non-perlbrew Perl.我在非 perlbrew Perl 上遇到完全相同的错误。 It seems autodie requires IPC::System::Simple when running under fatal warnings or with
:all
, but it doesn't require it during installation.在出现致命警告或使用
:all
运行时,似乎autodie需要IPC::System::Simple ,但在安装过程中不需要它。
See also https://bugzilla.redhat.com/show_bug.cgi?id=1183231 .另见https://bugzilla.redhat.com/show_bug.cgi?id=1183231 。
The solution, according to @ikegami, and that worked for me: /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'
根据@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'
of course, for anyone in the future, this will be slightly different for you, as your directories may be set differently, and username isn't con
当然,对于未来的任何人,这对您来说都会略有不同,因为您的目录可能设置不同,并且用户名不是
con
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.