MVP/Reader/Findable/ByExtension.pm

filter: Statementstmt 100% 16 / 16 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 82.1% 23 / 28 CC 3 SCAR 7.7
CC
3
Cov
86%
refined_location
3.3
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« MVP/Sequence.pm ↑ Summary MVP.pm »
1 package Config::MVP::Reader::Findable::ByExtension 2.200015;
2 # ABSTRACT: a Findable Reader that looks for files by extension
3  
4 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 with qw(Config::MVP::Reader::Findable);
7  
8 1 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 #pod =method default_extension
11 #pod
12 #pod This method, B<which must be composed by classes including this role>, returns
13 #pod the default extension used by files in the format this reader can read.
14 #pod
15 #pod When the Finder tries to find configuration, it have a directory root and a
16 #pod basename. Each (Findable) reader that it tries in turn will look for a file
17 #pod F<basename.extension> in the root directory. If exactly one file is found,
18 #pod that file is read.
19 #pod
20 #pod =cut
21  
22 1 requires 'default_extension';
23  
24 #pod =method refined_location
25 #pod
26 #pod This role provides a default implementation of the
27 #pod L<C<refined_location>|Config::MVP::Reader::Findable/refined_location> method
28 #pod required by Config::MVP::Reader. It will return a filename based on the
29 #pod original location, if a file exists matching that location plus the reader's
30 #pod C<default_extension>.
31 #pod
32 #pod =cut
33  
34 1 ▶sub refined_location {
Subroutine refined_location: called CC=3 SCAR=12.0
Pod documented
35 1 my ($self, $location) = @_;
36  
37 1 my $candidate_name = "$location." . $self->default_extension;
38 1 ▶ return unless -r $candidate_name and -f _;
Branch: 1 branch
BranchTrueFalseTotal
unless -r $candidate_name and -f _ 0 1 1
Condition33%1/3
-r $candidate_name and -f _
!ll&&!rl&&r
001
MC/DC0%0/2
-r $candidate_name and -f _
-r $candidate_name -f _
Truth table33%1/3
A and B
A= -r $candidate_nameB= -f _
ABresult
0X0
100
111
39 1 return $candidate_name;
40 }
41  
42 1 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 1 1;
44  
45 __END__
« MVP/Sequence.pm ↑ Summary MVP.pm »