X-Git-Url: http://git.shiar.net/sheet.git/blobdiff_plain/637b7a6936d2937561bdbcd44595384fc5cc14f3..e60ccb7426f287532b0cfb89632ff963698530b8:/browser.plp diff --git a/browser.plp b/browser.plp index 5811594..fe96312 100644 --- a/browser.plp +++ b/browser.plp @@ -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 "

Browser compatibility

\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 '

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 0.', ]); + 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';