Relocatable @INC puzzle

Toby Wintermute tjc at wintrmute.net
Fri Jul 16 05:31:20 BST 2010


On 14 July 2010 03:39, Paul Makepeace <paulm at paulm.com> wrote:
> I might be misunderstanding the purpose of this...
>
> I just built perl 5.12.1 with relocatable @INC but when I relocate (mv
> ~/perl5 ~/perl) the site_perl directories haven't moved, so CPAN
> breaks.
>
>  Compiled at Jul 12 2010 23:52:59
>  @INC:
>    /Users/paulmakepeace/perl5/lib/site_perl/5.12.1/darwin-thread-multi-2level
>    /Users/paulmakepeace/perl5/lib/site_perl/5.12.1
>    /Users/paulmakepeace/perl/lib/5.12.1/darwin-thread-multi-2level
>    /Users/paulmakepeace/perl/lib/5.12.1
>
> Rationale: I'm hoping to be able to build a perl that's completely
> self-contained that I can then bundle as part of an app/git checkout.
> The various developers will all be working with this on in their own
> home directories so this perl needs an @INC that's entirely relative.
>
> I can sort of see that there's an argument that moving the perl
> shouldn't move the CPAN but wondering if there's an official line, or
> this is a bug, or currently under discussion, and what the preferred
> way to solve this is (local::lib?), ...


I have been / still am working on a similar affair for the same
purpose. I've hit similar weirdness with @INC not doing what I
expected, but didn't resolve the problem.

However I note that "perlbrew"
http://search.cpan.org/dist/App-perlbrew/ has come along recently and
can help. It doesn't build you a relocateable Perl at all, however it
makes building a local Perl very easy.

So instead of giving your devs an all-in-one Perl tarball, you can say
"Run perlbrew and go and make a coffee", and by the time they come
back they have their own local perl instance. It'll have hardcoded
@INC still, but at least it's in their own directory.

Cheers,
Toby



More information about the london.pm mailing list