line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Nogizaka46::Base; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
19
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
74
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
69
|
|
5
|
3
|
|
|
3
|
|
14
|
use DateTime; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
71
|
|
6
|
3
|
|
|
3
|
|
13
|
use base qw(Class::Accessor); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
2651
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.0.1'; |
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
|
253
|
my $class = shift; |
29
|
153
|
|
|
|
|
317
|
my $self = bless {}, $class; |
30
|
|
|
|
|
|
|
|
31
|
153
|
|
|
|
|
846
|
$self->_initialize; |
32
|
|
|
|
|
|
|
|
33
|
153
|
|
|
|
|
666
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _initialize { |
37
|
153
|
|
|
153
|
|
222
|
my $self = shift; |
38
|
153
|
|
|
|
|
503
|
my %info = $self->info; |
39
|
|
|
|
|
|
|
|
40
|
153
|
|
|
|
|
34799
|
$self->{$_} = $info{$_} for keys %info; |
41
|
153
|
|
|
|
|
986
|
$self->{name_ja} = $self->family_name_ja.$self->first_name_ja; |
42
|
153
|
|
|
|
|
3706
|
$self->{name_en} = $self->first_name_en.' '.$self->family_name_en; |
43
|
153
|
|
|
|
|
3141
|
$self->{age} = $self->_calculate_age; |
44
|
|
|
|
|
|
|
|
45
|
153
|
|
|
|
|
2904
|
return 1; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _calculate_age { |
49
|
153
|
|
|
153
|
|
231
|
my $self = shift; |
50
|
153
|
|
|
|
|
477
|
my $today = DateTime->today; |
51
|
|
|
|
|
|
|
|
52
|
153
|
100
|
|
|
|
65575
|
if (($today->month - $self->birthday->month) > 0) { |
|
|
100
|
|
|
|
|
|
53
|
129
|
|
|
|
|
2692
|
return $today->year - $self->birthday->year; |
54
|
|
|
|
|
|
|
} elsif (($today->month - $self->birthday->month) == 0) { |
55
|
9
|
100
|
|
|
|
329
|
if (($today->day - $self->birthday->day ) >= 0) { |
56
|
3
|
|
|
|
|
53
|
return $today->year - $self->birthday->year; |
57
|
|
|
|
|
|
|
} else { |
58
|
6
|
|
|
|
|
106
|
return ($today->year - $self->birthday->year) - 1; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} else { |
61
|
15
|
|
|
|
|
535
|
return ($today->year - $self->birthday->year) - 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _datetime_from_date { |
66
|
195
|
|
|
195
|
|
8991
|
my ($self, $date) = @_; |
67
|
195
|
|
|
|
|
1172
|
my ($year, $month, $day) = ($date =~ /(\d{4})-(\d{2})-(\d{2})/); |
68
|
|
|
|
|
|
|
|
69
|
195
|
|
|
|
|
1062
|
DateTime->new( |
70
|
|
|
|
|
|
|
year => $year, |
71
|
|
|
|
|
|
|
month => $month, |
72
|
|
|
|
|
|
|
day => $day, |
73
|
|
|
|
|
|
|
); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |