sc: lotv patch v5.0.13 (2024-03-26)
[sheet.git] / browser.plp
index 5811594606a9bea5774ba7dd0a1b319803e74272..fe96312f6d74afcab57c1598be1e6177a8006689 100644 (file)
@@ -1,6 +1,5 @@
 <(common.inc.plp)><:
 use List::Util qw(sum max first);
-no if $] >= 5.018, warnings => 'experimental::smartmatch';
 
 Html({
        title => 'browser compatibility cheat sheet',
@@ -14,13 +13,12 @@ Html({
                html html5 css css3 svg javascript js dom mobile
                ie internet explorer firefox chrome safari webkit opera
        '],
-       stylesheet => [qw'circus dark mono red light'],
        data => ['data/browser/support.inc.pl'],
 });
 
 say "<h1>Browser compatibility</h1>\n";
 
-my $caniuse = do 'data/browser/support.inc.pl' or die $@ || $!;
+my $caniuse = Data('data/browser/support');
 
 my %CSTATS = (
        'n'   => 'l1',
@@ -84,19 +82,19 @@ say '<p id="intro">Alternate rendition of '.$ref;
 
 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>.',
                ]);
+               next;
        }
-       $canihas = do "data/browser/usage-$_.inc.pl" or do {
-               Alert('Browser usage data not found', $@ || $!);
-               break;
+
+       $canihas = eval { Data("data/browser/usage-$_") } or do {
+               Alert('Browser usage data not found', ref $@ ? @{$@} : $@);
+               next;
        };
        $usage = $_;
        my $ref = $canihas->{-title} || 'unknown';