Choose the right Perl distribution for you

There are several Perl distributions that you might choose, and each of them exists to serve a different audience. No one distribution is the right answer for you, and I can’t tell you which one to use without knowing about your situation and what’s important to you. Your possible solutions range from compiling, installing, and maintaining everything yourself to paying a support company to provide you with a compiled perl and pre-compiled modules for easy installation. Continue reading “Choose the right Perl distribution for you”

Build a new perl in parallel for fast results

When you get a new perl, you want to use it right away. Why wait for all that pesky compiling? As soon as the new tarball hits CPAN, you want to download it and start playing with it. You can make that process a little faster by running a parallel make. Continue reading “Build a new perl in parallel for fast results”

Use CORE when you need the real thing

Perl’s a dynamic language, which means you get to change the definition of almost anything while the programming is running. You can even change the defintions of Perl’s built-in subroutine. Once you (or the evil doer who wrote the module you need) change the definition, you might want to get back to the original, and Perl provides a way for you to do that. Continue reading “Use CORE when you need the real thing”

Compile a development version of perl

Nowadays, perl development happens at a fast clip. Every month there’s a new development release that gives you a preview of what’s going to show up in the next stable version. This not only gives the perl developers a chance to test the new perl in the wild, but also for you to try new features so you can get your application in shape for the next stable release of perl. As The Effective Perl gives you a preview of some of the upcoming features, you’ll need a development version of perl to try them for yourself. Continue reading “Compile a development version of perl”

Use the return value from srand

[This is another bonus, mid-week item since it’s so short and probably mostly useless as a tweak to what you already do.]

Perl 5.14 changes srand to return the seed that it used to start the pseudorandom number generator that gives you numbers through rand. There are plenty of interwebs that will explain the difference between real randomness and the sort that you get from computers, but for this item, suffice it to say that the numbers you get from perl are completely deterministic. If you start with the same seed, you get the same sequence. Continue reading “Use the return value from srand”

Use bitfields to index and search data

Although Perl makes it very easy to create, extend, or otherwise modify arrays, that doesn’t mean that a Perl array is the best way to store and search data. Not only do large arrays use up a lot of extra memory for each element (for an in-depth discussion, see the “Tie” chapter in Mastering Perl), but you don’t want to repeatedly traverse many arrays looking for what you’re after. Continue reading “Use bitfields to index and search data”

Turn off Perl 5.12 deprecation warnings, if you dare!

Perl 5.12 deprecates several features, for various reasons. Some of the features were always stupid, some need to make way for future development, and some are just too ornery to maintain. All of these are listed in the perldelta5120 documentation. The new thing, however, is that Perl 5.12 will warn you about these even if you don’t have warnings turned on. Consider this script full of Perl whoppers: Continue reading “Turn off Perl 5.12 deprecation warnings, if you dare!”

Make links to per-version tools

In Item 110: Compile and install your own perls, we showed you how to compile and install several versions of perl so that they don’t conflict with each other and you can use them simultaneously. Since they don’t install their programs, they are left in their $prefix/bin directories. With several perls, each of which has their own modules directories, using tools such as cpan and perldoc can get confusing. Which version of those tools are you using and which perl are they trying to use? Continue reading “Make links to per-version tools”