blib/lib/Getopt/Kingpin/Type/ExistingFile.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 36 / 36 SCAR 11.0
CC
3
Cov
100%
set_value
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.0
« blib/lib/Getopt/Kingpin/Type/ExistingDir.pm ↑ Summary blib/lib/Getopt/Kingpin/Type/ExistingFileOrDir.pm »
1 package Getopt::Kingpin::Type::ExistingFile;
2 1 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 our $VERSION = "0.09";
9  
10 sub set_value {
11 3 ▶ my $self = shift;
Subroutine set_value: called CC=3 SCAR=11.0
Pod documented
12 3 my ($value) = @_;
13  
14 3 my $p = path($value);
15 3 ▶ if ($p->is_dir) {
Branch: 2 branches
BranchTrueFalseTotal
if ($p->is_dir) { } 1 2 3
elsif ($p->is_file) { } 1 1 2
16 1 printf STDERR "error: '%s' is a directory, try --help\n", $value;
17 1 return undef, 1;
18 } elsif ($p->is_file) {
19 # ok
20 } else {
21 1 printf STDERR "error: path '%s' does not exist, try --help\n", $value;
22 1 return undef, 1;
23 }
24 1 return $p;
25 }
26  
27 1 1;
28 __END__
« blib/lib/Getopt/Kingpin/Type/ExistingDir.pm ↑ Summary blib/lib/Getopt/Kingpin/Type/ExistingFileOrDir.pm »