blib/lib/Acme/MadokaMagica/TvMembers.pm

filter: Statementstmt 90.6% 87 / 96 Branchbran 67.8% 19 / 28 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 17 / 17 Podpod 0.0% 0 / 12 totaltotal 80.3% 123 / 153 SCAR 28.8
CC
17
Cov
85%
new
4.0
name
3.1
color
3.0
CRAP 17.9
↑ Summary blib/lib/Acme/MadokaMagica.pm »
1 package Acme::MadokaMagica::TvMembers;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use Data::Section::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use YAML::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub new {
9 18 ▶ my ($class, %args) = @_;
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
10  
11 18 my $self = { _has_qb => undef };
12 18 my $ds = Data::Section::Simple->new($class);
13 18 my $sections = $ds->get_data_section;
14 18 for my $section_name ( keys %{$sections} ) {
15 18 my $yml = YAML::Tiny->read_string($sections->{$section_name});
16 18 my $member_info = $yml->[0];
17 18 for my $key ( keys %{$member_info} ) {
18 162 $self->{$key} = $member_info->{$key};
19 }
20 }
21 18 ▶ if (defined $args{line}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{'line'}) { } 13 5 18
22 13 $self->{startline} = $args{line};
23 } else {
24 5 $self->{startline} = (caller)[2];
25 }
26  
27 18 return bless $self, $class;
28 }
29  
30 sub has_qb {
31 46 ▶ my $self = shift;
Subroutine has_qb: called CC=2 SCAR=6.9
Pod undocumented
32  
33 46 ▶ if (@_){
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 7 39 46
34 7 $self->{_has_qb} = shift;
35 }
36  
37 46 return $self->{_has_qb};
38 }
39  
40 sub name {
41 16 ▶ my ($self) = @_;
Subroutine name: called CC=3 SCAR=11.2
Pod undocumented
42 16 my $line = (caller)[2];
43  
44 16 my $limit = $self->{startline} +100;
45 16 print "$line : $limit\n";
46 16 ▶ if( $line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 0 16 16
47 0 return undef;
48 }
49 16 ▶ return $self->has_qb ? $self->{witchename} : $self->lastname.' '.$self->firstname;
Branch: 1 branch
BranchTrueFalseTotal
$self->has_qb ? : 7 9 16
50 }
51  
52 sub firstname {
53 14 ▶ my $self = shift;
Subroutine firstname: called CC=2 SCAR=7.2
Pod undocumented
54 14 my $line = (caller)[2];
55  
56 14 my $limit = $self->{startline} +100;
57 14 ▶ if($line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 0 14 14
58 0 return undef;
59 }
60 14 return $self->{firstname};
61 }
62  
63 sub birthday {
64 5 ▶ my $self = shift;
Subroutine birthday: called CC=2 SCAR=7.2
Pod undocumented
65 5 my $line = (caller)[2];
66  
67 5 my $limit = $self->{startline} +100;
68 5 ▶ if($line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 0 5 5
69 0 return undef;
70 }
71 5 return $self->{birthday};
72 }
73  
74 sub blood_type {
75 5 ▶ my $self = shift;
Subroutine blood_type: called CC=2 SCAR=7.2
Pod undocumented
76 5 my $line = (caller)[2];
77  
78 5 my $limit = $self->{startline} +100;
79 5 ▶ if( $line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 0 5 5
80 0 return undef;
81 }
82 5 return $self->{blood_type};
83 }
84  
85 sub lastname {
86 14 ▶ my $self = shift;
Subroutine lastname: called CC=2 SCAR=7.2
Pod undocumented
87 14 my $line = (caller)[2];
88  
89 14 my $limit = $self->{startline} +100;
90 14 ▶ if( $line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 0 14 14
91 0 return undef;
92 }
93 14 return $self->{lastname};
94 }
95  
96 sub age {
97 5 ▶ my $self = shift;
Subroutine age: called CC=2 SCAR=7.2
Pod undocumented
98 5 my $line = (caller)[2];
99  
100 5 my $limit = $self->{startline} +100;
101 5 ▶ if( $line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 0 5 5
102 0 return undef;
103 }
104 5 return $self->{age};
105 }
106  
107 sub color{
108 15 ▶ my ($self) = @_;
Subroutine color: called CC=3 SCAR=11.0
Pod undocumented
109 15 my $line = (caller)[2];
110  
111 15 my $limit = $self->{startline} +100;
112 15 ▶ if( $line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 2 13 15
113 2 return undef;
114 }
115  
116 13 ▶ return $self->has_qb ? "black" : $self->{color};
Branch: 1 branch
BranchTrueFalseTotal
$self->has_qb ? : 5 8 13
117 }
118  
119 sub qb {
120 7 ▶ my ($self) = @_;
Subroutine qb: called CC=2 SCAR=7.2
Pod undocumented
121 7 my $line = (caller)[2];
122  
123 7 my $limit = $self->{startline} +100;
124 7 ▶ if( $line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 0 7 7
125 0 return undef;
126 }
127  
128 7 $self->has_qb(1);
129 }
130  
131 sub say {
132 8 ▶ my ($self) = @_;
Subroutine say: called CC=2 SCAR=7.2
Pod undocumented
133 8 my $line = (caller)[2];
134  
135 8 my $limit = $self->{startline} +100;
136 8 ▶ if( $line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 0 8 8
137 0 return undef;
138 }
139 8 return $self->{say};
140 }
141  
142 sub cv {
143 5 ▶ my $self = shift;
Subroutine cv: called CC=2 SCAR=7.2
Pod undocumented
144 5 my $line = (caller)[2];
145  
146 5 my $limit = $self->{startline} +100;
147 5 ▶ if( $line >= $limit ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($line >= $limit) 0 5 5
148 0 return undef;
149 }
150 5 return $self->{cv};
151 }
152  
153  
154 3 1;
↑ Summary blib/lib/Acme/MadokaMagica.pm »