line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Getopt::Kingpin::Type::ExistingFile; |
2
|
1
|
|
|
1
|
|
19
|
use 5.008001; |
|
1
|
|
|
|
|
4
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
6
|
1
|
|
|
1
|
|
7
|
use Path::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
196
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = "0.10"; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub set_value { |
11
|
3
|
|
|
3
|
1
|
6
|
my $self = shift; |
12
|
3
|
|
|
|
|
7
|
my ($value) = @_; |
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
|
|
7
|
my $p = path($value); |
15
|
3
|
100
|
|
|
|
91
|
if ($p->is_dir) { |
|
|
100
|
|
|
|
|
|
16
|
1
|
|
|
|
|
88
|
printf STDERR "error: '%s' is a directory, try --help\n", $value; |
17
|
1
|
|
|
|
|
45
|
return undef, 1; |
18
|
|
|
|
|
|
|
} elsif ($p->is_file) { |
19
|
|
|
|
|
|
|
# ok |
20
|
|
|
|
|
|
|
} else { |
21
|
1
|
|
|
|
|
66
|
printf STDERR "error: path '%s' does not exist, try --help\n", $value; |
22
|
1
|
|
|
|
|
10
|
return undef, 1; |
23
|
|
|
|
|
|
|
} |
24
|
1
|
|
|
|
|
44
|
return $p; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
__END__ |