I am a new perlbrew user, as I wish to upgrade to perl 5.30.0 on Ubuntu.
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? How can I get this simple script to run?
From autodie we see that it's documented behavior
If
system
is specified as an argument toautodie
, then it usesIPC::System::Simple
to do the heavy lifting. See the description of that module for more information.
So one does need IPC::System::Simple installed for :all
tag (which implies system
).
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. It seems autodie requires IPC::System::Simple when running under fatal warnings or with :all
, but it doesn't require it during installation.
See also 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'
/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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.