Setting up a Perl development environment
Posted by Alec The Geek on 11 December 2010
Here are my suggestions on how to set up your Perl development environment:
(NB If you are a Perl novice then start here)
- Install a copy of Perl
- Windows: Strawberry Perl
- UNIX developer with a Windows desktop? Use Cygwin
- Linux: Your distro should have Perl. See here for some suggestions on installing CPAN modules
- UNIX: I built my own and manually installed the modules. Easier than it sounds.
- OS/X: Comes with Perl
- Download a copy of the Perl Documentation and create a convenient shortcut
- Configure your favourite editor for Perl. There are some guidelines on Perl.net
- A decent version control tool (I use Git)
- Install PerlCritic, Perltidy, Devel::REPL, Module::Starter::PBP, GetOpt::Long and RegEx Coach
- Depending on the work you do consider the following modules as part of your ‘base’ kit:
- Run “
perl -MModule::Starter::PBP=setup” and accept the defaults - Modify the templates used by your editor and Module::Starter so that .pl have the following additional code:
# Main program Entry point sub main { use Getopt::Long qw(GetOptionsFromArray); # TODO Add options variables here # GetOptionsFromArray(\@_, #TODO Add option processing here #); #TODO Add application code here } return main(@ARGV) unless caller(); 1; # So we can treat this as a module for test purposes
Use:
- Have the local Perl docs open in your browser — there is a build in search engine
- Test perl assumptions about how Perl will behave by using Regex Coach and re.pl (re.pl runs from a terminal)
- Write your script (and modules) as a set of subroutines that you can test using Test::More and it’s siblings. You can test script subroutines by writing test scripts in the normal fashion and then running prove with the command line options “
-I ./lib -I .“ - Get good with your editor
- Use the branching feature of your version control tool to manage features (you are using Git right?)
- Don’t be afraid to refactor and fix stuff as you discover issues with previously written code
Caveats: This is based on my personal experience and preferences. Use it as a starting point only. I currently use Perl on Cygwin, Solaris and Linux with the Vim or vi editor. I tend to hack data munching scripts and I don’t use OO programming. YMMV.
8 Responses to “Setting up a Perl development environment”
Sorry, the comment form is closed at this time.

![[FSF Associate Member]](http://static.fsf.org/nosvn/associate/fsf-10505.png)
Alexandr Ciornii said
I hope that Strawberry Professional will be released soon. Beta version already includes Padre IDE. But Devel::REPL may not be included.
Ian said
Task::Kensho may be worth recommending
http://search.cpan.org/~perigrin/Task-Kensho-0.20/lib/Task/Kensho.pm
Ian said
Sorry, newest version:
http://search.cpan.org/~apeiron/Task-Kensho-0.26/lib/Task/Kensho.pm
dmckeon said
Explore local::lib to avoid collision issues
between a Linux distro’s Perl and modules,
and a personal installation that is always
being updated and/or having modules added to it.
Adrian said
Great succinct post on this topic. I’ve been a little out of touch with perl dev (I set up my environment a while ago using strawberry, but haven’t kept up with Module::Starter etc).
Ambrose said
OS X isn’t a variant of OS/2 as you seem to believe. It’s not written with a slash.
Jeff said
First, nice list, Thank you!
Just a quick note, GetOpt::Long should be Getopt::Long as a proper name. The way its shown here is not a findable module.
Regards and Happy Holidays!
Setting up a Perl development environment said
[...] updates you can follow me on Twitter. Thanks for visiting!I just came across an article about setting up a Perl development environment but I wanted to make some additional [...]