blib/lib/Getopt/Kingpin/Type/ExistingFileOrDir.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 21 | 21 | 100.0 |
branch | 2 | 2 | 100.0 |
condition | n/a | ||
subroutine | 6 | 6 | 100.0 |
pod | 1 | 1 | 100.0 |
total | 30 | 30 | 100.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Getopt::Kingpin::Type::ExistingFileOrDir; | ||||||
2 | 1 | 1 | 21 | use 5.008001; | |||
1 | 4 | ||||||
3 | 1 | 1 | 7 | use strict; | |||
1 | 2 | ||||||
1 | 37 | ||||||
4 | 1 | 1 | 7 | use warnings; | |||
1 | 2 | ||||||
1 | 29 | ||||||
5 | 1 | 1 | 5 | use Carp; | |||
1 | 2 | ||||||
1 | 71 | ||||||
6 | 1 | 1 | 7 | use Path::Tiny; | |||
1 | 1 | ||||||
1 | 164 | ||||||
7 | |||||||
8 | our $VERSION = "0.10"; | ||||||
9 | |||||||
10 | sub set_value { | ||||||
11 | 3 | 3 | 1 | 7 | my $self = shift; | ||
12 | 3 | 16 | my ($value) = @_; | ||||
13 | |||||||
14 | 3 | 20 | my $p = path($value); | ||||
15 | 3 | 100 | 125 | if ($p->exists) { | |||
16 | # ok | ||||||
17 | } else { | ||||||
18 | 1 | 118 | printf STDERR "error: path '%s' does not exist, try --help\n", $value; | ||||
19 | 1 | 12 | return undef, 1; | ||||
20 | } | ||||||
21 | 2 | 84 | return $p; | ||||
22 | } | ||||||
23 | |||||||
24 | 1; | ||||||
25 | __END__ |