GrammarBase/Role/DataDir.pm

filter: Statementstmt 90.0% 27 / 30 Branchbran 75.0% 3 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 80.0% 8 / 10 Podpod 100% 2 / 2 totaltotal 84.3% 43 / 51 CC 4 SCAR 5.8
CC
4
Cov
86%
__ANON__
3.0
_undefize
2.0
__ANON__
2.0
CRAP 1.8
↑ Summary GrammarBase/Role/RelaxNG.pm »
1 package XML::GrammarBase::Role::DataDir;
2 6 $XML::GrammarBase::Role::DataDir::VERSION = '0.2.10';
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6  
7 6 ▶use MooX::Role 'late';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 ▶use File::ShareDir qw(dist_dir);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 6 my $_component_re = qr/[A-Za-z_]\w*/;
12  
13 has 'module_base' => (
14 7 ▶ isa => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
15 7 my ($dist_name) = @_;
16 7 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $dist_name eq "" && $dist_name =~ /\A$_component_re(?:-$_component_re)*\z/) 1 6 7
Condition66%2/3
ref $dist_name eq '' && $dist_name =~ /\A$_component_re(?:-$_component_re)*\z/
!ll&&!rl&&r
016
MC/DC50%1/2
ref $dist_name eq '' && $dist_name =~ /\A$_component_re(?:-$_component_re)*\z/
ref $dist_name eq '' $dist_name =~ /\A$_component_re(?:-$_component_re)*\z/
Truth table66%2/3
A && B
A= ref $dist_name eq ''B= $dist_name =~ /\A$_component_re(?:-$_component_re)*\z/
ABresult
0X0
100
111
17 not( ( ref($dist_name) eq '' )
18 && ( $dist_name =~ m/\A$_component_re(?:-$_component_re)*\z/ ) )
19 )
20 {
21 1 die
22 "module_base must be a distribution string of components separated by dashes";
23 }
24 },
25 ,
26 6 is => 'rw'
27 );
28 has 'data_dir' => (
29 isa => 'Str',
30 is => 'rw',
31 0 ▶ default => sub { return shift->_calc_default_data_dir(); },
Subroutine __ANON__: not called CC=1 SCAR=6.9
32 6 lazy => 1,
33 );
34  
35 sub _calc_default_data_dir
36 0 ▶{
Subroutine _calc_default_data_dir: not called CC=1 SCAR=6.9
37 0 my ($self) = @_;
38  
39 0 return dist_dir( $self->module_base() );
40 }
41  
42 sub _undefize
43 3 ▶{
Subroutine _undefize: called CC=2 SCAR=7.1
44 3 my $class = shift;
45 3 my $v = shift;
46  
47 3 ▶ return defined($v) ? $v : "(undef)";
Branch: 1 branch
BranchTrueFalseTotal
defined $v ? : 0 3 3
48 }
49  
50 sub dist_path
51 6 ▶{
Subroutine dist_path: called CC=1 SCAR=0.0
Pod documented
52 6 my ( $self, $basename ) = @_;
53  
54 6 return File::Spec->catfile( $self->data_dir, $basename );
55 }
56  
57 sub dist_path_slot
58 6 ▶{
Subroutine dist_path_slot: called CC=1 SCAR=0.0
Pod documented
59 6 my ( $self, $slot ) = @_;
60  
61 6 return $self->dist_path( $self->$slot() );
62 }
63  
64 6 1;
65  
66 __END__
↑ Summary GrammarBase/Role/RelaxNG.pm »