Cmd/nearest_authors.pm

filter: Statementstmt 59.2% 16 / 27 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 58.8% 20 / 34 CC 2 SCAR 11.0
CC
2
Cov
55%
handle_cmd
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
↑ Summary Cmd/nearest_dists.pm »
1 package App::lcpan::Cmd::nearest_authors;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 require App::lcpan;
8  
9 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
10 1 our $DATE = '2022-03-27'; # DATE
11 1 our $DIST = 'App-lcpan-CmdBundle-nearest'; # DIST
12 1 our $VERSION = '0.003'; # VERSION
13  
14 1 our %SPEC;
15  
16 $SPEC{handle_cmd} = {
17 1 v => 1.1,
18 summary => "List CPAN ID's with names nearest to a specified name",
19 args => {
20 %App::lcpan::author_args,
21 },
22 };
23  
24 0 ▶sub handle_cmd {
Subroutine handle_cmd: not called CC=2 SCAR=17.9
Pod documented
25 0 my %args = @_;
26  
27 0 my $state = App::lcpan::_init(\%args, 'ro');
28 0 my $dbh = $state->{dbh};
29  
30 0 my $sth = $dbh->prepare("SELECT cpanid FROM author");
31 0 $sth->execute;
32 0 my @names;
33 0 ▶ while (my ($name) = $sth->fetchrow_array) { push @names, $name }
Branch: 1 branch
BranchTrueFalseTotal
if (my($name) = $sth->fetchrow_array) 0 0 0
34  
35 0 require Text::Fuzzy;
36 0 my $tf = Text::Fuzzy->new(uc $args{author});
37  
38 0 [200, "OK", [$tf->nearestv(\@names)]];
39 }
40  
41 1 1;
42 # ABSTRACT: List CPAN ID's with names nearest to a specified name
43  
44 __END__
↑ Summary Cmd/nearest_dists.pm »