[Purdue-pm] a one question survey

Joe Kline gizmo at purdue.edu
Mon Apr 19 08:51:45 PDT 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mark Daniel Ward wrote:
> Dear Purdue PM friends,
>     Did anyone install Perl 5.12 on their Mac last week?  I've installed
> Perl by hand on my Mac in the past (for instance, when Perl 5.10 was
> released), but I wanted to check and see if anybody had tried it yet.
>     I'm always cautious about such things, because I don't want to break
> the Apple pre-installed Perl, which is 5.10.0 in Mac OS X 10.6.3.
>     Any suggestions/advice or lessons learned?  Tips?


Mark,

here are a couple of posts from brian d foy and a book excerpt that look
to be useful for non-os Perl installs:


- From the upcoming Effective Perl Programming 2nd Edition
====================================================================
(the formatting sucks a bit because it's from a pdf brian gave us a
Frozen Perl).

Item 110. Compile and install your own perls.

Sometimes Perl suffers from its own success. It comes with just about
every version of operating systems with Unix or Linux heritages,
including Mac OS X. Many of these systems use Perl as part of their
normal operation or provide perl as packages. Even then, you can find
pre-compiled perls for most platforms.

Perl on Windows commonly uses precompiled binaries from ActiveState
(http://www.activestate.com), cygwin, or Strawberry Perl
(http://www.strawberryperl.com). People don’t have to compile their own
perl anymore.

There are many advantages to compiling and using your own perl, though.
Since many operating systems rely on perl for normal maintenance tasks,
you want to avoid anything that will break that perl. If you upgrade a
core module, for instance, an important part of the system may stop
working. You probably want to pretend that the system perl is not even
there.

Also, as a Perl developer, you should install several versions of perl
so you can test against each of them. It’s easy to install and maintain
distinct versions. This Item covers the basics, but your system may have
additional requirements. The perl distribution has several README files
that give instructions for particular operating systems.

Compiling your perl

To compile perl, you’ll need a C compiler and the build tools that
typically come with it. You’ll also need make or one of its variants.
You don’t need any special privileges, and you can install
perl in your own user directory. This Item assumes you have all of that
already worked out.

To start, download the version of perl that you want to test. You can
find all of the perl releases on CPAN (http://www.cpan.org/src/README.html).

Once you unpack your distribution, change into its directory. It’s time
to choose an installation location. For this example, you’ll put all of
your perls under /usr/local/perls, and each new installation will get
its own subdirectory under that.

The Configure script examines your system and prepares the perl sources
for compilation. The -des switches accept all of the default answers and
gives you terse output. The -D switch
overrides one of the answers, in this case for prefix which sets the
installation location.

% ./Configure -des -Dprefix=/usr/local/perls/perl-5.10.1

In this case, you’ve configured the build to install everything under
/usr/local/perls/perl-5.10.1. By accepting the defaults, you won’t move
the perl into /usr/bin, so don’t be afraid of messing up anything. You
should probably do this from an unprivileged account anyway, so your
system will stop you from doing anything too bad.

If you want to see everything that you can configure, don’t accept any
of the defaults and go through the entire process yourself (try it once
in life):

% ./Configure

After you run the Configure, no matter which options you used, you’re
ready to build the source. Depending on your system, you’ll need a make
variant:

% make all

When the build completes, you can test it, which might take a while:

% make test

And finally, you install it. You should see it copy files into the
directory you specified in prefix:

% make install

After you finish installing that perl, try installing another one. You
can enable different features, such as threads. You can change the
prefix to note the interesting feature of this perl:

% ./Configure -des -Dusethreads \
- -Dprefix=/usr/local/perls/perl-5.10.1-threaded

Using your perl

Once you install perl there’s nothing left for you to configure to use
it, although you have to use the path to the perl you want to use. You
can see the default module search path, for instance:

% /usr/local/perls/perl-5.10.1/bin/perl -V

All of the tools, extra programs, and modules for your new perl show up
under your prefix directory. If you want cpan to install modules for
this perl, you call the cpan for that perl. It’s in the bin directory
under your prefix:

% /usr/local/perls/perl-5.10.1/bin/cpan LWP::Simple

Any modules that you install in this fashion go into the library
directories just for that perl and do not disturb any other
installation. Indeed, that’s the point. Remember that when you switch to
using another perl: you might have to reinstall the modules for that
perl too.

If you want to read the documentation, you use the right path to perldoc
so it searches the correct module path:

% /usr/local/perls/perl-5.10.1/bin/perldoc↵
LWP::Simple

If you want to use this perl and its tools as your main perl, you can
add its path to your PATH environment variable. That leaves the system
perl in place, too. If you want to switch your default perl, you just
update your path so the shell finds the new default first. Everything
else, including the module paths, take care of themselves.

You might have some trouble with CPAN.pm or CPANPLUS, since they store
their configuration in your home directory (Item 65). Their
configurations are per-user instead of per-perl. Ensure that you update
their configuration for the perl that you want to use.

Things to remember
◾ Install your own perl so you don’t disturb the system perl.
◾ You can install multiple perls with different configurations.
◾ Add your preferred Perl’s location to your PATH to make it the default.
====================================================================

Manager Perl modules with git
http://www.effectiveperlprogramming.com/blog/60

Links for per-version tools
http://www.effectiveperlprogramming.com/blog/92

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Red Hat - http://enigmail.mozdev.org

iD8DBQFLzHwQb0mzA2gRTpkRAhgRAJ4lZiF4+KtEt5r5xJHHWmNiZUPIJQCfZtKb
enAGsZiK1VOJWJ9ZVEVALGs=
=UqVC
-----END PGP SIGNATURE-----


More information about the Purdue-pm mailing list