From 1fce3b7a43db2a10c3dbab2b3bc89dc7a90c3bad Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Wed, 8 Dec 2010 20:49:25 +0100 Subject: [PATCH] browser: parse support data first Move code right after header (no changes), so results can be used in intro and during usage parse. --- browser.plp | 53 +++++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/browser.plp b/browser.plp index b052863..27dcb1b 100644 --- a/browser.plp +++ b/browser.plp @@ -17,33 +17,8 @@ Html({ data => ['browser-support.inc.pl'], }); -:> -

Browser compatibility

- -

Alternate rendition of Fyrd's when can I use... page<: -my ($canihas, $usage); -given ($get{usage} // 'wm') { - when (!$_) { - # none - } - when (!/^\w+$/) { - printf "

Invalid browser usage data request: %s", - 'identifier must be alphanumeric name or 0'; - } - $canihas = do "browser-usage-$_.inc.pl" or do { - printf "

Browser usage data not found: %s", $! || $@; - break; - }; - $usage = $_; - my $ref = $canihas->{-source} || 'unknown'; - $ref = sprintf '%s', $_, $ref for $canihas->{-url} || (); - $ref .= " $_" for $canihas->{-date} || (); - print "\nwith $ref browser usage statistics"; -} -:>. -

+say "

Browser compatibility

\n"; -<: my $caniuse = do 'browser-support.inc.pl' or die $! || $@; $_->{verrelease} = { # mark last two (future) versions as unreleased, ensure current isn't @@ -94,6 +69,32 @@ if (my ($somerow) = values %{ $caniuse->{data} }) { my @browsers = grep { $versions{$_} } qw(trident gecko webkit_saf ios_saf webkit_chr android presto op_mob op_mini); +print <<''; +

Alternate rendition of Fyrd's when can I use... page + +my ($canihas, $usage); +given ($get{usage} // 'wm') { + when (!$_) { + # none + } + when (!/^\w+$/) { + printf "

Invalid browser usage data request: %s", + 'identifier must be alphanumeric name or 0'; + } + $canihas = do "browser-usage-$_.inc.pl" or do { + printf "

Browser usage data not found: %s", $! || $@; + break; + }; + $usage = $_; + my $ref = $canihas->{-source} || 'unknown'; + $ref = sprintf '%s', $_, $ref for $canihas->{-url} || (); + $ref .= " $_" for $canihas->{-date} || (); + print "\nwith $ref browser usage statistics"; +} +:>. +

+ +<: $canihas ||= { map { $_ => +{ -- 2.30.0