File Coverage

blib/lib/Duadua/Parser/Bot/Perplexity.pm
Criterion Covered Total %
statement 15 15 100.0
branch 7 8 87.5
condition 3 3 100.0
subroutine 3 3 100.0
pod 1 1 100.0
total 29 30 96.6


line stmt bran cond sub pod time code
1             package Duadua::Parser::Bot::Perplexity;
2 11     11   67 use strict;
  11         21  
  11         397  
3 11     11   47 use warnings;
  11         18  
  11         2970  
4              
5             sub try {
6 321     321 1 694 my ($class, $d) = @_;
7              
8 321 100 100     692 if ( $d->_contain_mozilla_top && $d->_contain('+https://perplexity.ai/') ) {
9              
10 4         11 my $h = {
11             name => 'PerplexityBot',
12             is_bot => 1,
13             };
14              
15 4 100       7 if ( $d->_contain('Perplexity-User/') ) {
16 2         3 $h->{name} = 'Perplexity-User';
17             }
18              
19 4 100       8 if ($d->opt_version) {
20 2         4 my ($version) = ($d->ua =~ m!Perplexity(?:-User|Bot)/([\d.]+)!);
21 2 50       7 $h->{version} = $version if $version;
22             }
23              
24 4         9 return $h;
25             }
26             }
27              
28             1;
29              
30             __END__