Custom perl installation cannot find Git.pm

I 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 is not installed from CPAN. Git.pm used by the perl system is located at /usr/share/perl5/Git.pm. How can I make this Git.pm available for a custom perl installation or get another copy of Git.pm installed in the right place? Should I just copy it to my own Perl lib directory?

+3
source share
3 answers

Git.pmis self-contained, so copy it to the directory part of your personal perl @INC. This requires Error.pm(with a version greater than or equal to 0.15009), so be sure to also install this module.

If you are looking for a Git shell (and not specifically Git.pm), several CPANs are available (in alphabetical order):

  • Git::Class
  • Git::Repository
  • Git::Wrapper
+5
source

You can follow the article Questions about Perl modules FAQ - What to do if Perl modules are not in their normal places , and add your module to the path @INCby directly modifying your Perl script, which is required Git.pm.

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

use the operator use libto add the search directory to the Perl search path.

+1
source

, Perl , PERL5LIB ( PERLLIB).

For your module / script to use some kind of module in a non-standard place, use use lib "<dir>";(I think, I think it is usually deprecated).

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

0
source

All Articles