Pad/Type/File.pm

filter: Statementstmt 96.2% 51 / 53 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 100% 5 / 5 totaltotal 95.8% 70 / 73 CC 3 SCAR 3.9
CC
3
Cov
95%
createPath
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.5
« Pad/Type/Float.pm ↑ Summary Pad/Type/Int.pm »
1 18 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 18 ▶use Object::Pad;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 18 ▶use Getopt::Pad::Type::Path;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 class Getopt::Pad::Type::File :isa(Getopt::Pad::Type::Path) :strict(params) {
7 18 ▶ use constant NAMES => ['file'];
Subroutine BEGIN: called CC=1 SCAR=0.0
8 18 ▶ use File::Basename ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 18 ▶ use File::Path ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 18 our $VERSION = '0.04';
12  
13 2 ▶ method label() { return 'File Path' }
Subroutine label: called CC=1 SCAR=0.0
Pod documented
14  
15 3 ▶ method kind() { return 'file' }
Subroutine kind: called CC=1 SCAR=0.0
Pod documented
16  
17 1 ▶ method completes() { return 'files' }
Subroutine completes: called CC=1 SCAR=0.0
Pod documented
18  
19 6 ▶ method pathExists($value) { return -f $value }
Subroutine pathExists: called CC=1 SCAR=0.0
Pod documented
20  
21 # The parent directories are created along with the empty file.
22 3 ▶ method createPath($value) {
Subroutine createPath: called CC=3 SCAR=11.2
Pod documented
23 3 File::Path::make_path(File::Basename::dirname($value), { error => \my $errors });
24 3 ▶ if ($errors->@*) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$errors) 0 3 3
25 0 my ($path, $reason) = $errors->[0]->%*;
26 0 return $reason;
27 }
28 3 ▶ open my $handle, '>>', $value or return "$!";
Branch: 1 branch
BranchTrueFalseTotal
open my $handle, ">>", $value or return "$!" 2 1 3
29 2 close $handle;
30 2 return undef;
31 18 }
32 }
33  
34 18 1;
35  
36 __END__
« Pad/Type/Float.pm ↑ Summary Pad/Type/Int.pm »