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

22,408

Solution 1

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

Solution 2

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.

Share:
22,408

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    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.

  • Nikita Kipriyanov
    Nikita Kipriyanov over 3 years
    It is not recommended to install with cpan or pip or pear or anything like this into the system which has packages managed with yum or apt or whatever. The consequences include that following ordinary package manager update system will broke and you'll work hard just to fix it. Don't do this yourself and never recommend this to anybody. You'd better recommend a concrete package to install with yum.