Corelist and Perlbrew - 2 Perl command line tools for remote Perl work
As a Perl developer who works remotely sometimes, there are Quality Assurance measures and sanity checks I must make before releasing code to clients. The two that come up most predominantly are:
- Will this script run under the Perl version available to the customer?
- What Modules can I use for the work?
Will this script run under the Perl version available to the customer?
Why is this question relevant? Well, as a Perl enthusiast, I keep relatively up to date on my Perl versions.
tyler@inspiron:~$ perl -v This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
I have found that Perl 5.8.x is the most common distribution available on all servers I have worked with. So, how to make sure the code I write will not break on a 5.8.x Interpreter?
It is a great tool that essentially lets you swap one Perl version for another! With one command, the default perl interpreter can be changed to another version, and I proceed with development with an environment that very closely matches that of the customer.
tyler@inspiron:~$ perlbrew switch perl-5.8.5
Perlbrew is available off of CPAN.
Perlbrews real strength however, is the ability to have it manage installing other Perl versions for you. Did you notice I only have Perl version 5.10.1? Well, with a simple
tyler@inspiron:~$ perlbrew install perl-5.12.2 ...
... Installed perl-5.12.2 as perl-5.12.2 successfully. Run the following command to switch to it. perlbrew switch perl-5.12.2
and approximately 20 minutes later, I'm much more up-to-date.
What Modules can I use for the work?
Some clients have sites on web servers without shell access. Therefore, I am limited in choice for Modules to use with the solution. Some can work by just adding the .pm file to an appropriate directory, but that is not guaranteed. That is when it is great to know your Core Modules. But how can you be sure which modules are guaranteed to work because they are part of the Core distribution?
Corelist available also at CPAN.
I think some sample command lines help illustrate the usefulness of this module. It takes one argument, a module name an answers the question: "Is this a core module, and if so, since which version?"
tyler@inspiron:~$ corelist XML::Parser XML::Parser was not in CORE (or so I think)
tyler@inspiron:~$ corelist Test
Test was first released with perl 5.00405
tyler@inspiron:~$ corelist HTML::Template
HTML::Template was not in CORE (or so I think)
tyler@inspiron:~$ corelist File::Copy
File::Copy was first released with perl 5.002
tyler@inspiron:~$ corelist version
version was first released with perl 5.009
tyler@inspiron:~$ corelist CGI
CGI was first released with perl 5.004
tyler@inspiron:~$ corelist FileHandle
FileHandle was first released with perl 5
tyler@inspiron:~$ corelist Pod::Html
Pod::Html was first released with perl 5.004
Thank you for reading!