X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/7d20f0f1160c15c1b52ba92dc86441766040c6ec..21a93def2665aa147da1a9acd03b644e59b74f5c:/perl.plp
diff --git a/perl.plp b/perl.plp
index de4637d..0ee9639 100644
--- a/perl.plp
+++ b/perl.plp
@@ -2,7 +2,7 @@
Html({
title => 'perl version cheat sheet',
- version => '1.4',
+ version => '1.7',
keywords => [qw'
perl version feature features comparison
sheet cheat overview summary
@@ -11,6 +11,7 @@ Html({
data => ['perl.inc.pl'],
});
+use experimental 'signatures';
:>
Perl release summary
@@ -56,8 +57,9 @@ eval {
$info->{$vcore}{versum} //= "official security patches";
# «We encourage vendors to ship the most recent supported release of Perl
- # at the time of their code freeze» with debian&ubuntu having 5 years LTS
- my $vendoreol = ($now - ONE_YEAR * 5)->strftime('%F');
+ # at the time of their code freeze»
+ # assume debian ships after 1 year, and expires after 5 years LTS
+ my $vendoreol = ($now - ONE_YEAR * 6)->strftime('%F');
my $vdebian = first {
$info->{$_}{release} ge $vendoreol && $info->{$_}{distro}{debian}
} @versions;
@@ -91,9 +93,9 @@ for my $vernum (reverse sort keys %{$info}) {
}
if (my $mods = $verrow->{modules}) {
for (@{$mods}) {
- my ($name, $desc, $eg) = @{$_};
+ my ($name, $desc, $attr) = @{$_};
my $ref = lc $name =~ s/::/_/gr;
- $desc .= sprintf ' {%s
}', Entity($_) for $eg // ();
+ $desc .= featattrs($attr);
printf 'use %s
', $ref, $name;
say '', $desc;
}
@@ -104,13 +106,16 @@ for my $vernum (reverse sort keys %{$info}) {
}
sub featattrs ($attr) {
+ $attr or return '';
+ ref $attr or $attr = {eg => $attr};
my $title;
if (defined $attr->{experimental}) {
$title = 'experimental';
}
- if ($attr->{dropped}) {
- next unless exists $get{v};
- $title = sprintf 'removed in %vd', $attr->{dropped};
+ if (defined $attr->{dropped}) {
+ no warnings 'exiting';
+ next unless exists $get{v}; # skip containing feature
+ $title = sprintf 'removed in %vd', $_ for $attr->{dropped} || ();
}
elsif ($attr->{stable}) {
$title .= sprintf ' until %vd', $attr->{stable};
@@ -126,6 +131,13 @@ sub featattrs ($attr) {
$title = join ', ', $prefix, $title // ();
$attr->{name} //= $attr->{feature};
}
- return sprintf ' (%s)', $title if $title;
- return '';
+ $title = $title ? sprintf ' (%s)', $title : '';
+
+ if (my $eg = $attr->{eg}) {
+ my $pre = Entity($eg);
+ $pre =~ s<\N{ZERO WIDTH SPACE}>{}g;
+ $pre = " {$pre
}";
+ $title = $pre . $title;
+ }
+ return $title;
}