File Coverage

blib/lib/Duadua/Parser/Bot/Baiduspider.pm
Criterion Covered Total %
statement 13 13 100.0
branch 5 6 83.3
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 22 23 95.6


line stmt bran cond sub pod time code
1             package Duadua::Parser::Bot::Baiduspider;
2 6     6   41 use strict;
  6         26  
  6         175  
3 6     6   32 use warnings;
  6         12  
  6         1107  
4              
5             sub try {
6 205     205 1 397 my ($class, $d) = @_;
7              
8 205 100       394 if ( index($d->ua, 'Baiduspider') > -1 ) {
9 5         19 my $h = {
10             name => 'Baiduspider',
11             is_bot => 1,
12             };
13              
14 5 100       18 if ($d->opt_version) {
15 2         7 my ($version) = ($d->ua =~ m!Baiduspider(?:-render)?/([\d.]+)!);
16 2 50       12 $h->{version} = $version if $version;
17             }
18              
19 5         55 return $h;
20             }
21             }
22              
23             1;
24              
25             __END__