bin/duckpan

filter: Statementstmt 100% 38 / 38 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 92.9% 53 / 57 CC 4 SCAR 6.6
CC
4
Cov
96%
BEGIN
4.0
__ANON__
1.0
BEGIN
1.0
CRAP 1.9
« blib/lib/App/DuckPAN/Config.pm ↑ Summary blib/lib/App/DuckPAN/Template.pm »
1 #!/usr/bin/env perl
2 # PODNAME: duckpan
3 # ABSTRACT: Command line tool for using the DuckPAN of DuckDuckGo
4  
5 4 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 my @libs;
8  
9 4 ▶BEGIN {
Subroutine BEGIN: called CC=4 SCAR=13.9
10 4 ▶ use Getopt::Long qw/:config bundling pass_through/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶ use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶ use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 4 GetOptions 'include|I=s' => \@libs;
14 4 @libs = split ',', join ',', @libs;
15 4 ▶ if (my @missing = grep { !$_->exists } map { path($_) } @libs) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@missing) = grep({not $_->exists;} map({path($_);} @libs))) 2 2 4
16 2 ▶ my $plural = (scalar @missing == 1) ? '' : 's';
Branch: 1 branch
BranchTrueFalseTotal
scalar @missing == 1 ? : 2 0 2
17 print STDERR '[FATAL ERROR] Missing include path' . $plural . ': ' . join(', ',
18 2 ▶ map { try { $_->realpath } || $_->absolute } @missing) . "\n";
Subroutine __ANON__: called CC=1 SCAR=0.0
Condition66%2/3
&try(sub { $_->realpath; } ) || $_->absolute
l!l&&r!l&&!r
110
MC/DC0%0/2
&try(sub { $_->realpath; } ) || $_->absolute
&try(sub { $_->realpath; } ) $_->absolute
Truth table66%2/3
A || B
A= &try(sub { $_->realpath; } )B= $_->absolute
ABresult
1X1
011
000
19 2 exit 1;
20 }
21  
22 # For other commands, bundling is desirable but pass_through leads to
23 # incomplete validation of command line arguments
24 2 Getopt::Long::Configure('no_pass_through');
25 }
26 2 ▶use lib @libs;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 2 $|=1;
29  
30 2 ▶use App::DuckPAN;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 2 App::DuckPAN->new_with_cmd;
32  
33 __END__
« blib/lib/App/DuckPAN/Config.pm ↑ Summary blib/lib/App/DuckPAN/Template.pm »