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   73 use strict;
  6         13  
  6         175  
3 6     6   29 use warnings;
  6         12  
  6         152  
4 6     6   39 use Duadua::Util qw//;
  6         23  
  6         2752  
5              
6             sub try {
7 400     400 1 815 my ($class, $d) = @_;
8              
9 400 100       758 return if index($d->ua, 'http') > -1;
10 237 100       591 return if index($d->ua, ' BingPreview') > -1;
11              
12 233 50 66     525 if ( index($d->ua, 'MSIE ') > -1 && index($d->ua, 'Mozilla/') > -1 && index($d->ua, 'Windows ') > -1 ) {
      66        
13 16         50 my $h = {
14             name => 'Internet Explorer',
15             is_windows => 1,
16             };
17              
18 16 100       39 if ($d->opt_version) {
19 8         22 my ($version) = ($d->ua =~ m! MSIE ([\d.]+); !);
20 8 50       38 $h->{version} = $version if $version;
21             }
22              
23 16         67 return $h;
24             }
25              
26 217 50 66     533 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         46 my $h = {
28             name => 'Internet Explorer',
29             is_windows => 1,
30             };
31              
32 14 100       40 if ($d->opt_version) {
33 7         18 my ($version) = ($d->ua =~ m! rv:([\d.]+)!);
34 7 50       30 $h->{version} = $version if $version;
35             }
36              
37 14         65 return $h;
38             }
39              
40 203 100       447 if ( index($d->ua, 'Windows-RSS-Platform/') > -1 ) {
41 2         8 my $h = {
42             name => 'Windows RSS Platform',
43             };
44              
45 2 100       9 if ($d->opt_version) {
46 1         5 my ($version) = ($d->ua =~ m!^Windows-RSS-Platform/([\d.]+)!);
47 1 50       7 $h->{version} = $version if $version;
48             }
49              
50 2         14 return Duadua::Util->set_os($d, $h);
51             }
52             }
53              
54             1;
55              
56             __END__