Install perl to $HOME

| 3 Comments | No TrackBacks

Since Perl 5.10.1 RC1 is out, it’s time to build my new shiny Perl!

I installed perl inside my $HOME directory ( /Users/gugod ), and here’s the way to do it:

cd ~/src; tar xzf perl-5.10.1-RC1.tar.gz
cd perl-5.10.1-RC1 
perl Configure -de -Dprefix=${HOME}/local
make
make test
make install

The -Dprefix=${HOME}/local makes it install to ~/local. Then you’ll find the perl executable at ~/local/bin/perl. Therefore I also add ~/local/bin to my PATH:

export PATH=${HOME}/local/bin:${PATH}

Why am I doing that ? Mostly because that it doesn’t require “sudo” when installing cpan modules with cpan or cpanp command. Therefore, if I need to move my $HOME to another machine (eg, when I buy a new Mac), it’s much more easier - I’ll just have to rsync my ~/local.

It’s also useful when it’s too much trouble upgrading system perl, or when you don’t really want to upgrade system perl, but want to play with those shiny Perl 5.10 features.

Update: chas.owens pointed out that one of the Cwd test will fail if the perl is building in /tmp, because /tmp is really /private/tmp on OSX. I modified this post to use ~/src as my building path.

No TrackBacks

TrackBack URL: http://pub.gugod.org/mt/mt-tb.cgi/215

3 Comments

Nice! And I see that autodie has been added to the core

$ perl           -E 'open my $fh, "NO_SUCH_FILE"; say "DONE!"'
DONE!
$ perl -Mautodie -E 'open my $fh, "NO_SUCH_FILE"; say "DONE!"'
Can't open 'NO_SUCH_FILE' for reading: 'No such file or directory' at -e line 1

At least on OS X 10.5, building in /tmp is not a good idea. The cwd test throws an error (because /tmp is really /private/tmp). Building in ~/src worked a lot better for me.

Thanks for pointing that out, I did see that Cwd test error but I simply ignored it ;)

Leave a comment

About this Entry

This page contains a single entry by gugod published on August 7, 2009 5:59 PM.

Movable Type Cutline Theme was the previous entry in this blog.

用 curl 抓中央氣象局的衛星雲圖回來看 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Pages

Powered by Movable Type 4.35-en