PRT/Command/ListFiles.pm

filter: Statementstmt 100% 19 / 19 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 85.7% 30 / 35 CC 3 SCAR 5.6
CC
3
Cov
96%
parse_arguments
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« PRT/Collector/Files.pm ↑ Summary PRT/Collector/FileHandle.pm »
1 package App::PRT::Command::ListFiles;
2 # Created by CXW based on App::PRT::Command::RenameClass
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Path::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
9 3 my ($class) = @_;
10 3 bless {eol => "\n"}, $class;
11 }
12  
13 # parse arguments from CLI. The only argument is `-0`, to output
14 # filenames separated by "\0" instead of "\n".
15 # arguments:
16 # @arguments
17 # returns:
18 # @rest_arguments
19 2 ▶sub parse_arguments {
Subroutine parse_arguments: called CC=3 SCAR=11.0
Pod undocumented
20 2 my ($self, @arguments) = @_;
21  
22 2 ▶ if(@arguments && $arguments[0] eq '-0') {
Branch: 1 branch
BranchTrueFalseTotal
if (@arguments and $arguments[0] eq "-0") 1 1 2
Condition66%2/3
@arguments and $arguments[0] eq "-0"
!ll&&!rl&&r
101
MC/DC50%1/2
@arguments and $arguments[0] eq "-0"
@arguments $arguments[0] eq "-0"
Truth table66%2/3
A and B
A= @argumentsB= $arguments[0] eq "-0"
ABresult
0X0
100
111
23 1 shift @arguments;
24 1 $self->{eol} = "\0";
25 }
26  
27 2 @arguments;
28 }
29  
30 # Output the filename.
31 # arguments:
32 # $file: filename
33 2 ▶sub execute {
Subroutine execute: called CC=1 SCAR=0.0
Pod undocumented
34 2 my ($self, $file) = @_;
35 2 print file($file), $self->{eol};
36 # Extra file() call to canonicalize
37 }
38  
39 1 1;
« PRT/Collector/Files.pm ↑ Summary PRT/Collector/FileHandle.pm »