File Coverage

blib/lib/Acme/MadokaMagica/TvMembers.pm
Criterion Covered Total %
statement 79 88 89.7
branch 17 26 65.3
condition n/a
subroutine 16 16 100.0
pod 1 11 9.0
total 113 141 80.1


line stmt bran cond sub pod time code
1             package Acme::MadokaMagica::TvMembers;
2              
3 3     3   1832 use Mouse;
  3         22215  
  3         14  
4              
5 3     3   729 use utf8;
  3         5  
  3         15  
6 3     3   1603 use Data::Section::Simple;
  3         1609  
  3         202  
7 3     3   1593 use YAML::Tiny;
  3         15294  
  3         228  
8              
9             has has_qb => (
10             is => 'rw',
11             isa => 'Bool',
12             required => 1,
13             default => 0,
14             );
15              
16 3     3   18 no Mouse;
  3         3  
  3         17  
17              
18             sub name {
19 16     16 0 3480 my ($self) = @_;
20 16         36 my $line = (caller)[2];
21              
22 16         26 my $limit = $self->{startline} +100;
23 16 50       39 if( $line >= $limit ) {
24 0         0 return undef;
25             }
26 16 100       108 return $self->has_qb ? $self->{witchename}:$self->lastname . ' ' .$self->firstname;
27             }
28              
29             sub firstname {
30 14     14 0 16 my $self = shift;
31 14         33 my $line = (caller)[2];
32              
33 14         20 my $limit = $self->{startline} +100;
34 14 50       34 if($line >= $limit ) {
35 0         0 return undef;
36             }
37 14         54 return $self->{firstname};
38             }
39              
40             sub birthday {
41 5     5 0 5 my $self = shift;
42 5         11 my $line = (caller)[2];
43              
44 5         8 my $limit = $self->{startline} +100;
45 5 50       11 if($line >= $limit ) {
46 0         0 return undef;
47             }
48 5         14 return $self->{birthday};
49             }
50              
51             sub blood_type {
52 5     5 0 6 my $self = shift;
53 5         12 my $line = (caller)[2];
54              
55 5         8 my $limit = $self->{startline} +100;
56 5 50       12 if( $line >= $limit ) {
57 0         0 return undef;
58             }
59 5         18 return $self->{blood_type};
60             }
61              
62             sub lastname {
63 14     14 0 17 my $self = shift;
64 14         34 my $line = (caller)[2];
65              
66 14         20 my $limit = $self->{startline} +100;
67 14 50       31 if( $line >= $limit ) {
68 0         0 return undef;
69             }
70 14         63 return $self->{lastname};
71             }
72              
73             sub age {
74 5     5 0 8 my $self = shift;
75 5         12 my $line = (caller)[2];
76              
77 5         8 my $limit = $self->{startline} +100;
78 5 50       11 if( $line >= $limit ) {
79 0         0 return undef;
80             }
81 5         15 return $self->{age};
82             }
83              
84             sub color{
85 13     13 0 645 my ($self) = @_;
86 13         29 my $line = (caller)[2];
87              
88 13         21 my $limit = $self->{startline} +100;
89 13 100       29 if( $line >= $limit ) {
90 1         4 return undef;
91             }
92              
93 12 100       63 return $self->has_qb ? "black" : $self->{color};
94             }
95              
96             sub qb {
97 7     7 0 14 my ($self) = @_;
98 7         15 my $line = (caller)[2];
99              
100 7         14 my $limit = $self->{startline} +100;
101 7 50       14 if( $line >= $limit ) {
102 0         0 return undef;
103             }
104              
105 7         40 $self->has_qb(1);
106             }
107              
108             sub say {
109 8     8 0 744 my ($self) = @_;
110 8         20 my $line = (caller)[2];
111              
112 8         16 my $limit = $self->{startline} +100;
113 8 50       19 if( $line >= $limit ) {
114 0         0 return undef;
115             }
116 8         29 return $self->{say};
117             }
118              
119             sub cv {
120 5     5 0 7 my $self = shift;
121 5         8 my $line = (caller)[2];
122              
123 5         8 my $limit = $self->{startline} +100;
124 5 50       13 if( $line >= $limit ) {
125 0         0 return undef;
126             }
127 5         14 return $self->{cv};
128             }
129              
130             sub BUILD {
131 16     16 1 5025 my ($self, $args) = @_;
132              
133 16         84 my $ds = Data::Section::Simple->new( ref $self );
134 16         114 my $sections = $ds->get_data_section;
135 16         1133 for my $section_name ( keys %{$sections} ) {
  16         54  
136 16         65 my $yml = YAML::Tiny->read_string( $sections->{$section_name} );
137 16         7557 my $member_info = $yml->[0];
138 16         17 for my $key ( keys %{$member_info} ) {
  16         74  
139 144         375 $self->{$key} = $member_info->{$key};
140             }
141             }
142 16 100       49 if (defined $args->{line}) {
143 7         69 $self->{startline} = $args->{line};
144             } else {
145 9         74 $self->{startline} = (caller)[2];
146             }
147             }
148              
149             1;