File Coverage

blib/lib/Acme/CPANModules/ModernPreambles.pm
Criterion Covered Total %
statement 3 3 100.0
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 4 4 100.0


line stmt bran cond sub pod time code
1             package Acme::CPANModules::ModernPreambles;
2              
3 1     1   400025 use strict;
  1         3  
  1         183  
4              
5             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
6             our $DATE = '2023-10-29'; # DATE
7             our $DIST = 'Acme-CPANModules-ModernPreambles'; # DIST
8             our $VERSION = '0.002'; # VERSION
9              
10             our $LIST = {
11             summary => 'List of modules that offer modern preambles',
12             description => <<'_',
13              
14             The overwhelming convention for coding Perl properly code is to at least add the
15             following preamble:
16              
17             use strict;
18             use warnings;
19              
20             to the beginning of your code. But some people say that's not enough, and they
21             develop modules/pragmas that bundle the above incantation plus some additional
22             stuffs. For example:
23              
24             use Modern::Perl '2018';
25              
26             is equivalent to:
27              
28             use strict;
29             use warnings;
30             use feature ':5.26';
31             mro::set_mro( scalar caller(), 'c3' );
32              
33             I think is one of the first to popularize this modern preamble
34             concept and a bunch of similar preambles emerged. This list catalogs them.
35              
36             Meanwhile, you can also use:
37              
38             use v5.12; # enables strict and warnings, as well as all 5.12 features (see for more details on new features of each perl release)
39              
40             and so on, but this also means you set a minimum Perl version.
41              
42             _
43             entries => [
44             {module=>'Alt::common::sense::TOBYINK'},
45             {module=>'common::sense'},
46             {module=>'latest'},
47             {module=>'Modern::Perl'},
48             {module=>'nonsense'},
49             {module=>'perl5'},
50             {module=>'perl5i'},
51             ],
52             };
53              
54             1;
55             # ABSTRACT: List of modules that offer modern preambles
56              
57             __END__