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 $now = Time::Piece->new;
36 $now = $now->strptime($_, '%Y-%m-%d') for $get{at} // ();
38 my $coreeol = ($now - ONE_YEAR * 3)->strftime('%F');
39 my $vcore = first { $info->{$_}{release} ge $coreeol } sort keys %{$info};
40 print "<p>Core security support is provided for 3 years";
41 print ", so typical users should run at least ", linkversion($_)
45 my $vendoreol = ($now - ONE_YEAR * 5)->strftime('%F');
47 $info->{$_}{release} ge $vendoreol && $info->{$_}{distro}{debian}
49 say sprintf "Stable distributions such as Debian %s maintain %s+.",
50 $info->{$_}{distro}{debian}, linkversion($_) for $vdebian // ();
52 my $nowcmp = $now->strftime('%F');
53 my $vdino = first { $info->{$_}{support} ge $nowcmp } sort keys %{$info};
54 say "Enterprise platforms retain versions up to $_."
55 for map { linkversion($_) } $vdino // ();
57 } or Alert('Missing version recommendations', $@);
60 for my $vernum (reverse sort keys %{$info}) {
61 my $verrow = $info->{$vernum};
62 defined $verrow->{unstable} and next unless exists $get{v};
64 say sprintf '<div class="section" id="%s">', vname($vernum);
65 say sprintf '<h2>%vd <small>%s</small></h2>', $vernum, $verrow->{release};
67 for (@{ $verrow->{new} }) {
68 my ($topic, $desc, $attr) = @{$_};
71 if (defined $attr->{experimental}) {
72 $title = 'experimental';
74 if ($attr->{dropped}) {
75 next unless exists $get{v};
76 $title = sprintf 'removed in %vd', $attr->{dropped};
78 elsif ($attr->{stable}) {
79 $title .= sprintf ' until %vd', $attr->{stable};
81 if ($attr->{experimental}) {
82 $title = sprintf '<span title="experimental::%s">%s</span>',
83 $attr->{experimental}, $title;
85 if ($attr->{feature}) {
86 my $prefix = sprintf '<span title="%s">feature</span>',
88 $title = join ', ', $prefix, $title // ();
90 $desc .= sprintf ' <em class="ex">(%s)</em>', $title;
92 say sprintf '<dt>%s<dd>%s', $topic, $desc || '<br/>';
94 say sprintf '<dt>Unicode</dt><dd>v%s', $_ for $verrow->{unicode} || ();