File Coverage

blib/lib/Duadua/Parser/Bot/AdIdxBot.pm
Criterion Covered Total %
statement 19 19 100.0
branch 8 10 80.0
condition 4 6 66.6
subroutine 4 4 100.0
pod 1 1 100.0
total 36 40 90.0


line stmt bran cond sub pod time code
1             package Duadua::Parser::Bot::AdIdxBot;
2 11     11   1104 use strict;
  11         56  
  11         510  
3 11     11   81 use warnings;
  11         18  
  11         4083  
4              
5             sub try {
6 333     333 1 787 my ($class, $d) = @_;
7              
8 333 50 66     718 if ( $d->_contain('adidxbot/')
      66        
9             && $d->_contain('+http://www.bing.com/bingbot.htm')
10             && $d->_contain_mozilla ) {
11 6         12 my $h = _set_property($d, 'AdIdxBot');
12              
13 6 100       13 if ($d->opt_version) {
14 3         8 my ($version) = ($d->ua =~ m!adidxbot/([\d.]+)!);
15 3 50       10 $h->{version} = $version if $version;
16             }
17              
18 6         16 return $h;
19             }
20             }
21              
22             sub _set_property {
23 6     6   9 my ($d, $name) = @_;
24              
25 6         14 my $h = {
26             name => $name,
27             is_bot => 1,
28             };
29              
30 6 100       14 if ( $d->_contain('Windows') ) {
    100          
31 2         4 $h->{is_windows} = 1;
32             }
33             elsif ( $d->_contain('iPhone') ) {
34 2         4 $h->{is_ios} = 1;
35             }
36              
37 6         12 return $h;
38             }
39              
40             1;
41              
42             __END__