better way to find Git.pm officially?

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

better way to find Git.pm officially?

From: Randal L. Schwartz <hidden>
Date: 2016-06-15 22:53:25

I'm using Git.pm in a git subcommand.  There doesn't (yet :) seem to be
an official way to *find* the directory Git.pm was installed in to add
it to my @INC, so I can up with this ugly hack:


    #!/usr/bin/perl
    use strict;

    use lib $ENV{GITPERLLIB}
      ? split(/:/, $ENV{GITPERLLIB})
      : do {
        chomp(my $exec_path = qx{git --exec-path});
        open my $gitsvn, "<", "$exec_path/git-svn" or die "Cannot find
      git-svn";
        {
          last unless local $_ = readline $gitsvn;
          redo unless m{\Ause lib.*GITPERLLIB.*\|\| "(.*)"};
          "$1";
        }
      };

    use Git;

As in, find the git-svn binary (via git --exec-path), parse its second
line to see where the git installer put the GITPERLLIB, and then add
that myself.

Is there a simpler way?  Can we get "git --perl-path" added to the
binary or something?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
[off-list ref] <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion

Re: better way to find Git.pm officially?

From: André Walker <hidden>
Date: 2016-06-15 22:53:25

On 03/29/2012 01:58 AM, Randal L. Schwartz wrote:
Is there a simpler way?  Can we get "git --perl-path" added to the
binary or something?
Maybe after the GSoC project? :)
Although a --perl-path would probably become unnecessary for newer 
versions. I guess after we publish Git.pm to CPAN, we could install it 
like a regular Perl module, and just have the perl scripts use it from 
default directories in @INC. Unless this will make too much trouble with 
compatibility (i.e., installing Git.pm v1.9 on a machine with git v1.8 
installed).

Re: better way to find Git.pm officially?

From: Jeff King <hidden>
Date: 2016-06-15 22:53:25

On Wed, Mar 28, 2012 at 09:58:12PM -0700, Randal L. Schwartz wrote:
As in, find the git-svn binary (via git --exec-path), parse its second
line to see where the git installer put the GITPERLLIB, and then add
that myself.

Is there a simpler way?  Can we get "git --perl-path" added to the
binary or something?
I always assumed that it was the responsibility of the user or the
packager to put Git.pm into a sane place that is found by perl's normal
lookup (possibly via the user's PERL5LIB if it is a per-user
installation). Doesn't our use of MakeMaker generally pick such a
suitable directory?

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help