line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Nogizaka46::Base; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
65
|
|
4
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
47
|
|
5
|
3
|
|
|
3
|
|
9
|
use DateTime; |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
48
|
|
6
|
3
|
|
|
3
|
|
8
|
use base qw(Class::Accessor); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
1365
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = 0.2; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw( |
11
|
|
|
|
|
|
|
name_ja |
12
|
|
|
|
|
|
|
first_name_ja |
13
|
|
|
|
|
|
|
family_name_ja |
14
|
|
|
|
|
|
|
name_en |
15
|
|
|
|
|
|
|
first_name_en |
16
|
|
|
|
|
|
|
family_name_en |
17
|
|
|
|
|
|
|
nick |
18
|
|
|
|
|
|
|
birthday |
19
|
|
|
|
|
|
|
age |
20
|
|
|
|
|
|
|
blood_type |
21
|
|
|
|
|
|
|
hometown |
22
|
|
|
|
|
|
|
class |
23
|
|
|
|
|
|
|
center |
24
|
|
|
|
|
|
|
graduate_date |
25
|
|
|
|
|
|
|
)); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
28
|
153
|
|
|
153
|
1
|
211
|
my $class = shift; |
29
|
153
|
|
|
|
|
222
|
my $self = bless {}, $class; |
30
|
|
|
|
|
|
|
|
31
|
153
|
|
|
|
|
462
|
$self->_initialize; |
32
|
|
|
|
|
|
|
|
33
|
153
|
|
|
|
|
448
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _initialize { |
37
|
153
|
|
|
153
|
|
121
|
my $self = shift; |
38
|
153
|
|
|
|
|
324
|
my %info = $self->info; |
39
|
|
|
|
|
|
|
|
40
|
153
|
|
|
|
|
22567
|
$self->{$_} = $info{$_} for keys %info; |
41
|
153
|
|
|
|
|
651
|
$self->{name_ja} = $self->family_name_ja.$self->first_name_ja; |
42
|
153
|
|
|
|
|
2263
|
$self->{name_en} = $self->first_name_en.' '.$self->family_name_en; |
43
|
153
|
|
|
|
|
1691
|
$self->{age} = $self->_calculate_age; |
44
|
|
|
|
|
|
|
|
45
|
153
|
|
|
|
|
1618
|
return 1; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _calculate_age { |
49
|
153
|
|
|
153
|
|
142
|
my $self = shift; |
50
|
153
|
|
|
|
|
303
|
my $today = DateTime->today; |
51
|
|
|
|
|
|
|
|
52
|
153
|
100
|
|
|
|
41442
|
if (($today->month - $self->birthday->month) > 0) { |
|
|
100
|
|
|
|
|
|
53
|
30
|
|
|
|
|
404
|
return $today->year - $self->birthday->year; |
54
|
|
|
|
|
|
|
} elsif (($today->month - $self->birthday->month) == 0) { |
55
|
15
|
100
|
|
|
|
367
|
if (($today->day - $self->birthday->day ) >= 0) { |
56
|
9
|
|
|
|
|
91
|
return $today->year - $self->birthday->year; |
57
|
|
|
|
|
|
|
} else { |
58
|
6
|
|
|
|
|
55
|
return ($today->year - $self->birthday->year) - 1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} else { |
61
|
108
|
|
|
|
|
2286
|
return ($today->year - $self->birthday->year) - 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _datetime_from_date { |
66
|
198
|
|
|
198
|
|
6348
|
my ($self, $date) = @_; |
67
|
198
|
|
|
|
|
995
|
my ($year, $month, $day) = ($date =~ /(\d{4})-(\d{2})-(\d{2})/); |
68
|
|
|
|
|
|
|
|
69
|
198
|
|
|
|
|
697
|
DateTime->new( |
70
|
|
|
|
|
|
|
year => $year, |
71
|
|
|
|
|
|
|
month => $month, |
72
|
|
|
|
|
|
|
day => $day, |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |