5 minimums for any perl script?

Damian Conway damian at conway.org
Mon Jan 30 00:07:53 GMT 2012


Joseph Werner wrote:

> I will agree with always 'use strict', I have never [yet] had to not
> 'use warnings' AFTER development.

If your test suite's code coverage is thorough and your tests closely
mimic your users' real-world usages, then I agree that leaving warnings
on in deployed code does no harm at all.

But if your testing doesn't meet those criteria, warnings in production
code can result in a horde of anxious users reporting ABSOLUTELY
CRITICAL "Use of undefined value" bugs, which results in needless
anxiety for everyone concerned.


> Explicitly stating minimum Perl version requirement does not rise to
> the same level of concern as  'use strict'  and 'use warnings'.  How
> often do you regression test to know the minimum Perl version
> requirement anyhow?

I'm not suggesting that you state *the* minimum version requirement,
I'm suggesting you state *your* minimum version requirement.

The easiest way not to be deluged with a bucketload of "This doesn't
work under our current installation of Perl 5.6.1!!!!" is to document
and enforce whatever version you developed your code under as the
minimum version required.

This advice is mainly because there are still an absurd number of people
stuck on 5.8 (for perfectly good reasons), which version I now no longer
support. A simple 'use 5.010' in the code avoids an endless amount of
fruitless email discussion and cajoling about my decision to treat 5.10
(and soon, 5.12) as my minimal supported platform.

A 'use VERSION' is also future-proofing, given the changes in
behaviour that have been mooted for future versions of the compiler
(namely that, as far as possible, future versions of perl may
endeavour to provide the semantics of whichever Perl version
is explicitly specified in the source).

Damian



More information about the london.pm mailing list