browser: cleanup duplicate support determination
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 15 Dec 2010 23:07:43 +0000 (00:07 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 15 Dec 2010 23:44:33 +0000 (00:44 +0100)
browser.plp

index 6c06a2e..863f806 100644 (file)
@@ -268,12 +268,17 @@ sub saybrowsercols {
 
        my ($prev, @span);
        for my $ver (@{ $versions{$browser} }, undef) {
-               unless (!defined $prev
-               or ref $data eq 'HASH' && $data->{$prev} ~~ $data->{$ver}) {
+               my $compare = (
+                       !defined $ver ? undef :      # last column if nameless
+                       ref $data ne 'HASH' ? 'u' :  # unsupported if no support hash
+                       $data->{$ver}                # known
+                       || 'u'                       # unsure unless oldest is unsupported
+               );
+               unless (!defined $prev or $prev ~~ $compare) {
                        my $usage = sum(map { $canihas->{$browser}->{$_} } @span);
                        printf '<td class="%s" colspan="%d" title="%s">%s',
                                join(' ',
-                                       X => $CSTATS{ ref $data eq 'HASH' && $data->{$prev} || 'u' },
+                                       X => $CSTATS{$prev},
                                        !$usage ? ('p0') : ('p',
                                                sprintf('p%01d', $usage * ($usagepct - .0001) / 10),
                                                sprintf('p%02d', $usage * ($usagepct - .0001)),
@@ -285,14 +290,14 @@ sub saybrowsercols {
                                        map { ref $_ eq 'CODE' ? $_->($browser) : $_ }
                                        map { $DSTATS{$_} // () }
                                        map { split / /, $_ }
-                                       ref $data eq 'HASH' && $data->{$prev} || 'u'
+                                       $prev
                                )),
                                showversions(@span),
                        undef $prev;
                        @span = ();
                }
                push @span, $ver;
-               $prev = $ver;
+               $prev = $compare;
        }
 }