perl: initial overview of features per perl version
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 26 Mar 2012 16:48:45 +0000 (18:48 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Tue, 10 Apr 2012 01:03:24 +0000 (03:03 +0200)
perl.inc.pl [new file with mode: 0644]
perl.plp [new file with mode: 0644]

diff --git a/perl.inc.pl b/perl.inc.pl
new file mode 100644 (file)
index 0000000..30fe00c
--- /dev/null
@@ -0,0 +1,38 @@
+use utf8;
+
++{
+       v5.6 => [
+               ['use utf8'],
+               ['\N{named character}'],
+               ['our'],
+               ['v1.2.3'],
+               ['sub :locked :method'],
+               ['open $fh, $mode, $expr'],
+       ],
+       v5.8 => [
+               ['unicode overhaul'],
+               ['PerlIO'],
+       ],
+       v5.10 => [
+               ['//', 'defined-or operator'],
+               ['~~', 'smart-match operator to compare different data types'],
+               ['given', 'switch statement to smart-match with when/default'],
+               ['/(?<name>)/ and $+{name}', 'named caputer buffers'],
+               ['s/keep\K//', 'floating positive lookbehind, efficient alternative for s/(keep)/$1/'],
+               ['/\v/, /\h/', 'vertical and horizontal whitespace escapes'],
+               ['my $_', 'lexically scoped version of the default variable'],
+       ],
+       v5.12 => [
+               ['package version', 'package NAME VERSION shorthand for our $VERSION"'],
+               ['...', 'yada-yada operator: code placeholder'],
+               ['use strict', 'Implicit strictures if use VERSION >= 5.12'],
+               ['... when', '"when" is now allowed to be used as a statement modifier'],
+       ],
+       v5.14 => [
+               ['s///r', 'non-destructive substitution'],
+               ['/(?^)/', 'construct to reset to default modifiers'],
+               ['/(?{ m// })/', 'regular expressions can be nested in /(?{})/ and /(??{})/'],
+               ["use re '/flags'", 'customize default modifiers'],
+               ['each $ref e.a.', 'array and hash container functions accept references'],
+       ],
+}
diff --git a/perl.plp b/perl.plp
new file mode 100644 (file)
index 0000000..255032a
--- /dev/null
+++ b/perl.plp
@@ -0,0 +1,25 @@
+<(common.inc.plp)><:
+
+Html({
+       title => 'perl version cheat sheet',
+       version => 'v1.0',
+       keywords => [qw'
+               perl version feature features comparison
+               sheet cheat overview summary
+       '],
+       stylesheet => [qw'light dark red'],
+});
+
+:>
+<h1>Perl cheat sheets</h1>
+
+<:
+my $info = do 'perl.inc.pl' or die $@ // $!;
+for my $ver (reverse sort keys %{$info}) {
+       print '<div class="section">'."\n";
+       printf '<h2>%vd</h2><dl>'."\n", $ver;
+       printf '<dt>%s<dd>%s', Entity(@{$_}), '<br/>' for @{ $info->{$ver} };
+       print "</dl>\n";
+       print "</div>\n\n";
+}
+