Package Info

perl-common-sense


Save a tree AND a kitten, use common::sense!


Development/Libraries/Perl

“Nothing is more fairly distributed than common sense: no one thinks he needs more of it than he already has.”

– René Descartes

This module implements some sane defaults for Perl programs, as defined by two typical (or not so typical - use your common sense) specimens of Perl coders. In fact, after working out details on which warnings and strict modes to enable and make fatal, we found that we (and our code written so far, and others) fully agree on every option, even though we never used warnings before, so it seems this module indeed reflects a "common" sense among some long-time Perl coders.

The basic philosophy behind the choices made in common::sense can be summarised as: "enforcing strict policies to catch as many bugs as possible, while at the same time, not limiting the expressive power available to the programmer".

Two typical examples of how this philosophy is applied in practise is the handling of uninitialised and malloc warnings:

  • uninitialised

'undef' is a well-defined feature of perl, and enabling warnings for using it rarely catches any bugs, but considerably limits you in what you can do, so uninitialised warnings are disabled.

  • malloc

Freeing something twice on the C level is a serious bug, usually causing memory corruption. It often leads to side effects much later in the program and there are no advantages to not reporting this, so malloc warnings are fatal by default.

Unfortunately, there is no fine-grained warning control in perl, so often whole groups of useful warnings had to be excluded because of a single useless warning (for example, perl puts an arbitrary limit on the length of text you can match with some regexes before emitting a warning, making the whole 'regexp' category useless).

What follows is a more thorough discussion of what this module does, and why it does it, and what the advantages (and disadvantages) of this approach are.


License: GPL-1.0-or-later OR Artistic-1.0
URL: https://metacpan.org/release/common-sense

Categories

Releases

Package Version Update ID Released Package Hub Version Platforms Subpackages
3.75-bp155.1.5 info GA Release 2023-05-17 15 SP5
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-common-sense
3.74-bp154.1.49 info GA Release 2022-05-09 15 SP4
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-common-sense
3.74-bp153.1.17 info GA Release 2021-03-06 15 SP3
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-common-sense
3.74-bp152.3.23 info GA Release 2020-04-16 15 SP2
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-common-sense
3.74-bp151.3.1 info GA Release 2019-07-16 15 SP1
  • ppc64le
  • s390x
  • x86-64
  • perl-common-sense
3.74-bp151.2.15 info GA Release 2019-05-18 15 SP1
  • AArch64
  • perl-common-sense
3.74-bp150.2.4 info GA Release 2018-07-30 15
  • AArch64
  • ppc64le
  • s390x
  • x86-64
  • perl-common-sense