|
In this part of the Perl tutorial series we are going to see where to download Perl from and how to install it. Perl is maintained and released by a dedicated team of volunteers who call themselves Perl 5 Porters. Once a year they release a new major version of Perl and a few more times a year they release minor bug fixes. The latest major version was 5.14 (released in May 2011) with 5.14.2 (September 2011) being the most recent minor release. The README on CPAN always contains the most up to date information. What they release is the source code of Perl, which is usually then packaged by distributors or vendors. Most of us use Perl from such downstream distributors. It is expected that within a few months of any release the various downstream distributors will include the latest revision of Perl. If you are using Linux you'll get the new version of Perl only if you upgrade your operating system. This might happen regularly on a home machine but it is much slower in corporations and on servers. They tend to upgrade only in a 2-5 years delay.
WindowsThere are a number of distributors of Perl on Windows. Currently the most recommended distribution is the Padre on Strawberry Perl package. It is a derivative of the very successful Strawberry Perl distribution with hundreds of extra modules already included. Besides coming with Padre, the Perl IDE, it also includes Moose, the post modern object oriented programming framework of Perl. Out of the box it allows web development with Perl Dancer framework. There is a post on how to get started with Perl Dancer. It also includes modules to read and write Microsoft Excel files and it comes with a lot more extensions. In the first episode of the Perl Tutorial I explained, and in the screencast showed how to install Perl on Windows. Another distribution is called ActivePerl by ActiveState. It has certain advantages, especially if you are planning to buy a support or redistribution license. Upgrading of these distributions usually involves removing the old ones and installing a new one. Then installing all the additional modules.
LinuxEvery modern Linux distribution comes with perl already installed. In some cases it is not the full package that was released by the Perl 5 porters and in most cases it is not the most recent version either. That would not be a problem but in some cases they still include very old (5 -7 years old) versions of Perl. You will encounter such cases especially in Linux distributions with long support policy. For example the Long Term Support of Ubuntu. Of course every in those distributions is very old, not only Perl but Perl could be upgraded independently. To get started with Perl it will be OK to use the one that came with the operating system, but at one point you might want to install the newest version of Perl. We will go deeper in this issue in another article but for now it is enough to say, that this became very easy recently with the development of Perlbrew. In some Linux distributions not all "standard" Perl is included by default. For example many distributions leave out the documentation. You can either read it via perldoc web site or you can usually install it with the standard package management system of your operating system. For example on Debian or Ubuntu you can install the Perl documentation using: sudo aptitude install perl-doc
Mac OSXI don't have any experience with Mac OSX but as far as I know the situation is similar to that on Linux.
UNIXOn the UNIX side the state is not that good. Some major UNIX distributions are still supplying Perl from the 5.005 line which is based on a version released in 1995. If possible download and install a recent version of Perl and use that for any new development.
Download, compile and install PerlYou can download the source code of Perl from CPAN and then follow the instructions on that page:
wget http://www.cpan.org/src/5.0/perl-5.14.2.tar.gz
tar -xzf perl-5.14.2.tar.gz
cd perl-5.14.2
./Configure -des -Dprefix=$HOME/localperl
make
make test
make install
Once you have done this you can check your new version of perl by typing $HOME/localperl/bin/perl -v to make this the default perl, you'd probably want to add to your .bashrc export PATH=$HOME/localperl/bin/:$PATH
Learn Perl directionsThe learn Perl website also has its recommended approaches to installing Perl. Check that out too.
Perl tutorial and video courseFor further articles see the Beginner Perl Maven tutorial book and video course.In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation. blog comments powered by Disqus |
Follow me: