File Coverage

blib/lib/Duadua/Parser/Bot/Googlebot.pm
Criterion Covered Total %
statement 22 22 100.0
branch 11 12 91.6
condition 3 3 100.0
subroutine 4 4 100.0
pod 1 1 100.0
total 41 42 97.6


line stmt bran cond sub pod time code
1             package Duadua::Parser::Bot::Googlebot;
2 11     11   1176 use strict;
  11         25  
  11         404  
3 11     11   68 use warnings;
  11         21  
  11         551  
4 11     11   54 use Duadua::Util;
  11         17  
  11         4053  
5              
6             sub try {
7 400     400 1 944 my ($class, $d) = @_;
8              
9 400 100       870 return unless $d->_contain('Google');
10              
11 63 100 100     180 if ( $d->_contain('Googlebot') && !$d->_contain('Googlebot-') ) {
12 18         84 my $h = {
13             name => 'Googlebot',
14             is_bot => 1,
15             };
16              
17 18 100       64 if ($d->opt_version) {
18 11         88 my ($version) = ($d->ua =~ m!Googlebot/([\d.]+)!);
19 11 50       58 $h->{version} = $version if $version;
20             }
21              
22 18         90 return Duadua::Util->set_os($d, $h);
23             }
24              
25 45 100       126 if ( $d->_contain('Google Favicon') ) {
26 1         4 my $h = {
27             name => 'Google Favicon',
28             is_bot => 1,
29             };
30              
31 1         5 return Duadua::Util->set_os($d, $h);
32             }
33              
34 44 100       126 if ( $d->_contain('APIs-Google') ) {
35             return {
36 1         9 name => 'APIs-Google',
37             is_bot => 1,
38             };
39             }
40             }
41              
42             1;
43              
44             __END__