git/list[1] front-page[2] threads[3] people[4] search[5] about
 

better way to find Git.pm officially?

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
Mar 29, 2012, 04:58 UTC
Message-ID
<86r4wc9f6j.fsf@red.stonehenge.com>

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
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.posterous.com/ for Smalltalk discussion
Next: André Walker
Message 1 of 4 in “better way to find Git.pm officially?”
  1. Randal L. SchwartzMar 29, 2012
  2. André WalkerMar 29, 2012
  3. Jeff KingMar 29, 2012
  4. Junio C HamanoMar 29, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.