File Coverage

blib/lib/Duadua/Parser/Browser/MicrosoftInternetExplorer.pm
Criterion Covered Total %
statement 30 30 100.0
branch 17 22 77.2
condition 9 15 60.0
subroutine 4 4 100.0
pod 1 1 100.0
total 61 72 84.7


line stmt bran cond sub pod time code
1             package Duadua::Parser::Browser::MicrosoftInternetExplorer;
2 6     6   35 use strict;
  6         14  
  6         161  
3 6     6   28 use warnings;
  6         18  
  6         230  
4 6     6   35 use Duadua::Util qw//;
  6         16  
  6         2434  
5              
6             sub try {
7 399     399 1 776 my ($class, $d) = @_;
8              
9 399 100       764 return if index($d->ua, 'http') > -1;
10 236 100       514 return if index($d->ua, ' BingPreview') > -1;
11              
12 232 50 66     499 if ( index($d->ua, 'MSIE ') > -1 && index($d->ua, 'Mozilla/') > -1 && index($d->ua, 'Windows ') > -1 ) {
      66        
13 16         56 my $h = {
14             name => 'Internet Explorer',
15             is_windows => 1,
16             };
17              
18 16 100       33 if ($d->opt_version) {
19 8         19 my ($version) = ($d->ua =~ m! MSIE ([\d.]+); !);
20 8 50       28 $h->{version} = $version if $version;
21             }
22              
23 16         56 return $h;
24             }
25              
26 216 50 66     488 if ( index($d->ua, 'Trident/') > -1 && index($d->ua, ' rv:1') > -1 && index($d->ua, 'Mozilla/') > -1 && index($d->ua, 'Windows ') > -1 ) {
      66        
      33        
27 14         54 my $h = {
28             name => 'Internet Explorer',
29             is_windows => 1,
30             };
31              
32 14 100       40 if ($d->opt_version) {
33 7         25 my ($version) = ($d->ua =~ m! rv:([\d.]+)!);
34 7 50       23 $h->{version} = $version if $version;
35             }
36              
37 14         50 return $h;
38             }
39              
40 202 100       430 if ( index($d->ua, 'Windows-RSS-Platform/') > -1 ) {
41 2         7 my $h = {
42             name => 'Windows RSS Platform',
43             };
44              
45 2 100       9 if ($d->opt_version) {
46 1         4 my ($version) = ($d->ua =~ m!^Windows-RSS-Platform/([\d.]+)!);
47 1 50       5 $h->{version} = $version if $version;
48             }
49              
50 2         13 return Duadua::Util->set_os($d, $h);
51             }
52             }
53              
54             1;
55              
56             __END__