{"thread":{"id":"30093","subject":"better way to find Git.pm officially?","startedAt":"2012-03-29T04:58:12Z","lastAt":"2012-03-29T06:45:53Z","messageCount":4,"participants":["Randal L. Schwartz","André Walker","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188032","messageId":"86r4wc9f6j.fsf@red.stonehenge.com","threadId":"30093","inReplyTo":null,"subject":"better way to find Git.pm officially?","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2012-03-29T04:58:12Z","receivedAt":"2012-03-29T04:58:12Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":"\nI'm using Git.pm in a git subcommand.  There doesn't (yet :) seem to be\nan official way to *find* the directory Git.pm was installed in to add\nit to my @INC, so I can up with this ugly hack:\n\n\n    #!/usr/bin/perl\n    use strict;\n\n    use lib $ENV{GITPERLLIB}\n      ? split(/:/, $ENV{GITPERLLIB})\n      : do {\n        chomp(my $exec_path = qx{git --exec-path});\n        open my $gitsvn, \"<\", \"$exec_path/git-svn\" or die \"Cannot find\n      git-svn\";\n        {\n          last unless local $_ = readline $gitsvn;\n          redo unless m{\\Ause lib.*GITPERLLIB.*\\|\\| \"(.*)\"};\n          \"$1\";\n        }\n      };\n\n    use Git;\n\nAs in, find the git-svn binary (via git --exec-path), parse its second\nline to see where the git installer put the GITPERLLIB, and then add\nthat myself.\n\nIs there a simpler way?  Can we get \"git --perl-path\" added to the\nbinary or something?\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nSmalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.\nSee http://methodsandmessages.posterous.com/ for Smalltalk discussion\n"},{"id":"188033","messageId":"4F73EEDB.7000009@andrewalker.net","threadId":"30093","inReplyTo":"86r4wc9f6j.fsf@red.stonehenge.com","subject":"Re: better way to find Git.pm officially?","fromName":"André Walker","fromEmail":"andre@andrewalker.net","sentAt":"2012-03-29T05:10:51Z","receivedAt":"2012-03-29T05:10:51Z","isPatch":false,"sender":{"key":"andre@andrewalker.net","avatar":"https://gravatar.com/avatar/30629538efaccb36c1bed44fa1e943bc5bfdd3c4341775f735faa45db1231756?d=mp&s=160"},"body":"On 03/29/2012 01:58 AM, Randal L. Schwartz wrote:\n> Is there a simpler way?  Can we get \"git --perl-path\" added to the\n> binary or something?\nMaybe after the GSoC project? :)\nAlthough a --perl-path would probably become unnecessary for newer \nversions. I guess after we publish Git.pm to CPAN, we could install it \nlike a regular Perl module, and just have the perl scripts use it from \ndefault directories in @INC. Unless this will make too much trouble with \ncompatibility (i.e., installing Git.pm v1.9 on a machine with git v1.8 \ninstalled).\n"},{"id":"188039","messageId":"20120329061336.GE27604@sigill.intra.peff.net","threadId":"30093","inReplyTo":"86r4wc9f6j.fsf@red.stonehenge.com","subject":"Re: better way to find Git.pm officially?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-03-29T06:13:36Z","receivedAt":"2012-03-29T06:13:36Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Mar 28, 2012 at 09:58:12PM -0700, Randal L. Schwartz wrote:\n\n> As in, find the git-svn binary (via git --exec-path), parse its second\n> line to see where the git installer put the GITPERLLIB, and then add\n> that myself.\n> \n> Is there a simpler way?  Can we get \"git --perl-path\" added to the\n> binary or something?\n\nI always assumed that it was the responsibility of the user or the\npackager to put Git.pm into a sane place that is found by perl's normal\nlookup (possibly via the user's PERL5LIB if it is a per-user\ninstallation). Doesn't our use of MakeMaker generally pick such a\nsuitable directory?\n\n-Peff\n"},{"id":"188040","messageId":"7vwr63rjku.fsf@alter.siamese.dyndns.org","threadId":"30093","inReplyTo":"20120329061336.GE27604@sigill.intra.peff.net","subject":"Re: better way to find Git.pm officially?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-03-29T06:45:53Z","receivedAt":"2012-03-29T06:45:53Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> I always assumed that it was the responsibility of the user or the\n> packager to put Git.pm into a sane place that is found by perl's normal\n> lookup (possibly via the user's PERL5LIB if it is a per-user\n> installation).\n\nUnfortunately, not really.\n\nSee what this target does in our Makefile:\n\n\t$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl\n\nOur scripts know where INSTLIBDIR is, so that we can redirect INSTLIBDIR\nto whatever directory that the packager or the user wants to, which may be\noutside the usual PERL5LIB.\n\nEspecially with NO_PERL_MAKEMAKER installation, perl/Makefile points at\n$(prefix)/lib with INSTLIBDIR, and $(prefix) is by default $(HOME), so...\n"}]}