4 title => 'perl version cheat sheet',
7 perl version feature features comparison
8 sheet cheat overview summary
10 stylesheet => [qw'light dark red'],
11 data => ['perl.inc.pl'],
15 <h1>Perl release summary</h1>
17 <p>The most significant features introduced for recent versions of the Perl
20 my $info = Data('perl');
22 use feature 'signatures';
24 return sprintf 'v%d%03d', unpack 'C*', $v;
26 sub linkversion ($v) {
27 return showlink(sprintf('%vd', $v), '#'.vname($v));
31 use List::Util 'first';
35 my @versions = sort keys %{$info};
36 my $now = Time::Piece->new;
37 $now = $now->strptime($_, '%Y-%m-%d') for $get{at} // ();
39 # perlpolicy: «We "officially" support the two most recent stable release
40 # series. [...] we will attempt to fix critical issues»
41 $info->{ $versions[-2] }{versum} //= "active core support";
42 $info->{ $versions[-1] }{versum} //= "latest stable release";
44 # perlpolicy: «we will attempt to fix critical issues in the two most
45 # recent stable 5.x release series»
46 my $coreeol = ($now - ONE_YEAR * 3)->strftime('%F');
47 my $vcore = first { $info->{$_}{release} ge $coreeol } @versions;
48 print "<p>Core security support is provided for 3 years";
49 print ", so typical users should run at least ", linkversion($_)
52 $info->{$vcore}{versum} //= "official security patches";
54 # «We encourage vendors to ship the most recent supported release of Perl
55 # at the time of their code freeze» with debian&ubuntu having 5 years LTS
56 my $vendoreol = ($now - ONE_YEAR * 5)->strftime('%F');
58 $info->{$_}{release} ge $vendoreol && $info->{$_}{distro}{debian}
60 say sprintf "Stable distributions such as Debian %s maintain %s+.",
61 $info->{$_}{distro}{debian}, linkversion($_) for $vdebian // ();
62 $info->{$vdebian}{versum} //= "still maintained by common vendors";
64 # extended support given at random
65 my $nowcmp = $now->strftime('%F');
66 my $vdino = first { $info->{$_}{support} ge $nowcmp } @versions;
67 say "Enterprise platforms retain versions up to $_."
68 for map { linkversion($_) } $vdino // ();
70 } or Alert('Missing version recommendations', $@);
73 for my $vernum (reverse sort keys %{$info}) {
74 my $verrow = $info->{$vernum};
75 defined $verrow->{unstable} and next unless exists $get{v};
77 say sprintf '<div class="section" id="%s">', vname($vernum);
78 my $title = $verrow->{release} // '?';
79 $title .= ": $_" for $verrow->{versum} // ();
80 say sprintf '<h2>%vd <small>%s</small></h2>', $vernum, $title;
82 for (@{ $verrow->{new} }) {
83 my ($topic, $desc, $attr) = @{$_};
86 if (defined $attr->{experimental}) {
87 $title = 'experimental';
89 if ($attr->{dropped}) {
90 next unless exists $get{v};
91 $title = sprintf 'removed in %vd', $attr->{dropped};
93 elsif ($attr->{stable}) {
94 $title .= sprintf ' until %vd', $attr->{stable};
96 if ($attr->{experimental}) {
97 $title = sprintf '<span title="experimental::%s">%s</span>',
98 $attr->{experimental}, $title;
100 if ($attr->{feature}) {
101 my $prefix = sprintf '<span title="%s">feature</span>',
103 $title = join ', ', $prefix, $title // ();
105 $desc .= sprintf ' <em class="ex">(%s)</em>', $title;
107 say sprintf '<dt>%s<dd>%s', $topic, $desc || '<br/>';
109 say sprintf '<dt>Unicode</dt><dd>v%s', $_ for $verrow->{unicode} || ();