| 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
| |||||||||||||||||||||
| 16 | 2 | ▶ | my $plural = (scalar @missing == 1) ? '' : 's'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
MC/DC0%0/2
&try(sub {
$_->realpath;
}
) || $_->absolute
&try(sub {
$_->realpath;
}
)
$_->absolute
Truth table66%2/3
A || B
A= &try(sub {
$_->realpath;
}
)B= $_->absolute
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||