browser: replace smartmatch by equivalent syntax
authorMischa POSLAWSKY <perl@shiar.org>
Mon, 26 Aug 2024 18:04:58 +0000 (20:04 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 2 Sep 2024 19:29:58 +0000 (21:29 +0200)
browser.plp
tools/mkcharinfo

index c32e808445eac2a1b3de582a5db0c1ae4dcf6012..5a48f778cc27d0e5dd86598d5b5c0a9d1f3c451c 100644 (file)
@@ -1,6 +1,5 @@
 <(common.inc.plp)><:
 use List::Util qw(sum max first);
 <(common.inc.plp)><:
 use List::Util qw(sum max first);
-no if $] >= 5.018, warnings => 'experimental::smartmatch';
 
 Html({
        title => 'browser compatibility cheat sheet',
 
 Html({
        title => 'browser compatibility cheat sheet',
@@ -83,19 +82,19 @@ say '<p id="intro">Alternate rendition of '.$ref;
 
 my ($canihas, $usage);
 my $minusage = $get{threshold} // 1;
 
 my ($canihas, $usage);
 my $minusage = $get{threshold} // 1;
-given ($get{usage} // 'wm') {
-       when (!$_) {
-               # none
-       }
-       when (!m{ \A [a-z]\w+ (?:/\d[\d-]*\d)? \z }x) {
+for ($get{usage} // 'wm') {
+       $_ or next;  # none
+       unless (m{ \A [a-z]\w+ (?:/\d[\d-]*\d)? \z }x) {
                Alert([
                        'Invalid browser usage data request',
                        'Identifier must be alphanumeric name or <q>0</q>.',
                ]);
                Alert([
                        'Invalid browser usage data request',
                        'Identifier must be alphanumeric name or <q>0</q>.',
                ]);
+               next;
        }
        }
+
        $canihas = eval { Data("data/browser/usage-$_") } or do {
                Alert('Browser usage data not found', $@);
        $canihas = eval { Data("data/browser/usage-$_") } or do {
                Alert('Browser usage data not found', $@);
-               break;
+               next;
        };
        $usage = $_;
        my $ref = $canihas->{-title} || 'unknown';
        };
        $usage = $_;
        my $ref = $canihas->{-title} || 'unknown';
index 8bf3d54fb62bea78a537947f7360209a7031ea34..088a1ac0dfb59f32292776e969cf88951886131b 100755 (executable)
@@ -2,7 +2,6 @@
 use 5.014;
 use warnings;
 use utf8;
 use 5.014;
 use warnings;
 use utf8;
-no if $] >= 5.018, warnings => 'experimental::smartmatch';
 use lib '.';
 
 use open OUT => ':encoding(utf-8)', ':std';
 use lib '.';
 
 use open OUT => ':encoding(utf-8)', ':std';