File Coverage

blib/lib/Duadua/Parser/Bot/GooglebotMobile.pm
Criterion Covered Total %
statement 27 27 100.0
branch 15 16 93.7
condition 8 9 88.8
subroutine 4 4 100.0
pod 1 1 100.0
total 55 57 96.4


line stmt bran cond sub pod time code
1             package Duadua::Parser::Bot::GooglebotMobile;
2 11     11   104 use strict;
  11         26  
  11         429  
3 11     11   72 use warnings;
  11         36  
  11         495  
4 11     11   59 use Duadua::Util;
  11         19  
  11         4305  
5              
6             sub try {
7 379     379 1 879 my ($class, $d) = @_;
8              
9 379 100       1077 return unless $d->_contain('oogle');
10              
11 44 100       132 if ( $d->_contain('googleweblight') ) {
12 1         6 my $h = {
13             name => 'googleweblight',
14             is_bot => 1,
15             };
16              
17 1         7 return Duadua::Util->set_os($d, $h);
18             }
19              
20 43 100 100     143 if ( $d->_contain('AdsBot-Google-Mobile') && !$d->_contain('AdsBot-Google-Mobile-') ) {
21 2         11 my $h = {
22             name => 'AdsBot-Google-Mobile',
23             is_bot => 1,
24             };
25              
26 2         13 return Duadua::Util->set_os($d, $h);
27             }
28              
29 41 100       115 if ( $d->_contain('AdsBot-Google-Mobile-Apps') ) {
30             return {
31 1         7 name => 'AdsBot-Google-Mobile-Apps',
32             is_bot => 1,
33             };
34             }
35              
36 40 100 100     124 if ( ( $d->_prefix('SAMSUNG-SGH-E250/') || $d->_prefix('DoCoMo/') )
      66        
37             && $d->_contain(' Googlebot-Mobile/') ) {
38             return {
39 2         16 name => 'Googlebot-Mobile',
40             is_bot => 1,
41             };
42             }
43              
44 38 100       98 if ( $d->_contain('DuplexWeb-Google') ) {
45 2         11 my $h = {
46             name => 'DuplexWeb-Google',
47             is_bot => 1,
48             };
49              
50 2 100       8 if ($d->opt_version) {
51 1         5 my ($version) = ($d->ua =~ m!DuplexWeb-Google/([\d.]+)!);
52 1 50       6 $h->{version} = $version if $version;
53             }
54              
55 2         26 return Duadua::Util->set_os($d, $h);
56              
57             }
58             }
59              
60             1;
61              
62             __END__