File Coverage

blib/lib/Duadua/Parser/Bot/YandexBot.pm
Criterion Covered Total %
statement 16 16 100.0
branch 5 6 83.3
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 26 27 96.3


line stmt bran cond sub pod time code
1             package Duadua::Parser::Bot::YandexBot;
2 11     11   1268 use strict;
  11         24  
  11         416  
3 11     11   54 use warnings;
  11         49  
  11         637  
4 11     11   62 use Duadua::Util qw//;
  11         20  
  11         2683  
5              
6             sub try {
7 224     224 1 549 my ($class, $d) = @_;
8              
9 224 100       498 if ( $d->_contain('+http://yandex.com/bots') ) {
10 6         30 my $h = {
11             name => 'Yandex Bot',
12             is_bot => 1,
13             };
14              
15 6 100       22 if ($d->opt_version) {
16 3         14 my ($version) = ($d->ua =~ m!compatible; [^/]+/([\d.]+); \+http://yandex!);
17 3 50       19 $h->{version} = $version if $version;
18             }
19              
20 6         42 return Duadua::Util->set_os($d, $h);
21             }
22             }
23              
24             1;
25              
26             __END__