Perl script can't locate Env.pm in @INC

2

1

I am trying to run a Perl script that, near the beginning, has

use Env '$Foo1', '$Foo2';

I am getting the following message:

Can't locate Env.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ../path/to/Foo3 line 8

I have tried to find the Env.pm module (find . -name Env.pm -print) but nothing happens, it just returns to the command prompt.

I am using RHEL7 and perl v5.16.3.

NuclearVision

Posted 2017-02-21T19:13:59.377

Reputation: 21

Answers

5

Install the perl-Env package to obtain Env.pm.

yum install perl-Env

You can also use the whatprovides feature of yum to see what packages provide files,

yum whatprovides */Env.pm

perl-Env-1.04-2.el7.noarch : Perl module that imports environment variables as scalars or arrays Repo        : base Matched from: Filename    : /usr/share/perl5/vendor_perl/Env.pm

Scott-Mc

Posted 2017-02-21T19:13:59.377

Reputation: 86

1

RPM packaging has an established standard for noting what package contains what Perl module. The format is: perl(<NAME>). So in your case, you can run the command yum install 'perl(Env)', and see that it resolves to the perl-Env package. Unfortunately, you can't just depend on the package name itself, as some packages provide multiple modules, and things move in and out of the main perl package occasionally. The format above is the easiest way to consistently install the right package.

carlwgeorge

Posted 2017-02-21T19:13:59.377

Reputation: 289