开发者

Custom perl installation cannot find Git.pm

开发者 https://www.devze.com 2023-03-09 08:51 出处:网络
I have installed my own copy of Perl in my home directory, but I have some Perl scripts that require Git.pm, which is part of the Git distribution and not installable from CPAN. The Git.pm used by the

I have installed my own copy of Perl in my home directory, but I have some Perl scripts that require Git.pm, which is part of the Git distribution and not installable from CPAN. The Git.pm used by the system perl resides at /usr/share/perl5/Git.pm. How can I make this Git.pm available to a 开发者_JS百科custom perl install, or get another copy of Git.pm installed in the correct location? Should I just copy it into my own Perl's lib directory?


Git.pm is self-contained, so copying it in a directory part of your private perl @INC. It requires Error.pm (with version greater or equal to 0.15009), so don't forget to install that module as well.

If you're looking for a Git wrapper (and not specifically Git.pm), there are several available on CPAN (in alphabetical order):

  • Git::Class
  • Git::Repository
  • Git::Wrapper


You can follow the article Perl modules FAQ - What to do when Perl modules aren't in their normal locations, and add your module in the @INC variable path, by modifying directly your Perl script which needs Git.pm.

#!/usr/bin/perl
use lib "/home/george/modules";
print "\@INC is @INC\n";

use the use lib statement to add your search directory to Perl's search path.


To control where Perl searches for modules, use PERL5LIB (or PERLLIB).

To have your module/script use some module at non-standard location, use use lib "<dir>"; (thought I think it is usually deprecated).

To install Perl modules locally from CPAN, use local::lib.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号