-
Notifications
You must be signed in to change notification settings - Fork 42
New to Perl Development
If you've never patched a Perl module before, this is a guide to help you get your Perl development environment setup and learn how to work with a Perl module out of its repository.
- http://learn.perl.org/ has all the basics for those new to Perl.
- chromatic's Modern Perl book is free and a great introduction to programmer Perl for reals.
This isn't strictly necessary, but it will help you in the long and probably even short run.
-
We highly recommend you install your own copy of Perl in your user directory with perlbrew. Different operating systems have different versions of Perl and break it in different ways. perlbrew will guarantee you have a consistent, up-to-date install of Perl. It will save you and your mentor a lot of time. Once you have perlbrew installed, run
perlbrew init
and follow its instructions. Thennice perlbrew install perl-5.14.2
will compile and install (in your user directory, it won't interfere with your operating system's perl) a fresh copy of Perl.nice
makes sure it doesn't slow down your machine while it's doing so. It might take 10-30 minutes depending on your hardware. Make a sandwich. -
We recommend you install cpanminus which is one of the simplest and friendliest CPAN clients for installing Perl modules. perlbrew can do it for you or you can follow cpanminus' normal installation instructions.
For a module on Github, you'll have to clone
the git repository to get a copy of the code. Please see help.github.com for more information. We also recommend the free Pro Git book written by one of the Github folks.
To install a Perl module you need to first install any modules it depends on. Sometimes folks refer to this as "dependency hell". Fortunately, if you're using perlbrew and cpanminus, we can do it the easy way.
-
First,
cd
to the source directory of the module you just cloned. -
Then run
perl Build.PL
which configures the module for installation. It should complain about a lot of missing modules. There's a lot of ways to resolve this, but we'll show you how to do it with cpanminus. -
cpanm --installdeps .
will install all the dependencies for the Perl module whose source tree you're sitting in. Alternatively you can runperl Build installdeps
. -
Run
perl Build.PL
again and it should be happy. -
Run
perl Build
to build the module. -
Run
perl Build test
to run the module's tests. -
It all worked? Great! You're ready to develop. If it didn't work, find someone to help.