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 6     6   747 use strict;
  6         11  
  6         158  
3 6     6   26 use warnings;
  6         9  
  6         142  
4 6     6   27 use Duadua::Util qw//;
  6         12  
  6         939  
5              
6             sub try {
7 200     200 1 465 my ($class, $d) = @_;
8              
9 200 100       394 if ( index($d->ua, '+http://yandex.com/bots') > -1 ) {
10 6         19 my $h = {
11             name => 'Yandex Bot',
12             is_bot => 1,
13             };
14              
15 6 100       13 if ($d->opt_version) {
16 3         7 my ($version) = ($d->ua =~ m!compatible; [^/]+/([\d.]+); \+http://yandex!);
17 3 50       12 $h->{version} = $version if $version;
18             }
19              
20 6         20 return Duadua::Util->set_os($d, $h);
21             }
22             }
23              
24             1;
25              
26             __END__