git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: git@vger.kernel.org
Subject: better way to find Git.pm officially?
Date: Wed, 28 Mar 2012 21:58:12 -0700	[thread overview]
Message-ID: <86r4wc9f6j.fsf@red.stonehenge.com> (raw)


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

             reply	other threads:[~2012-03-29  4:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-29  4:58 Randal L. Schwartz [this message]
2012-03-29  5:10 ` better way to find Git.pm officially? André Walker
2012-03-29  6:13 ` Jeff King
2012-03-29  6:45   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86r4wc9f6j.fsf@red.stonehenge.com \
    --to=merlyn@stonehenge.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).