line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::MomoiroClover; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
58740
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
124
|
|
4
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
106
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
17
|
use Carp qw(croak); |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
193
|
|
7
|
3
|
|
|
3
|
|
927
|
use Date::Simple (); |
|
3
|
|
|
|
|
17932
|
|
|
3
|
|
|
|
|
88
|
|
8
|
3
|
|
|
3
|
|
674
|
use Acme::MomoiroClover::Z; |
|
3
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
2473
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.2'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my @members = qw( |
13
|
|
|
|
|
|
|
AriyasuMomoka |
14
|
|
|
|
|
|
|
FujishiroSumire |
15
|
|
|
|
|
|
|
HayamiAkari |
16
|
|
|
|
|
|
|
IkuraManami |
17
|
|
|
|
|
|
|
KashiwaYukina |
18
|
|
|
|
|
|
|
MomotaKanako |
19
|
|
|
|
|
|
|
SasakiAyaka |
20
|
|
|
|
|
|
|
TakagiReni |
21
|
|
|
|
|
|
|
TakaiTsukina |
22
|
|
|
|
|
|
|
TamaiShiori |
23
|
|
|
|
|
|
|
WagawaMiyuu |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub new { |
27
|
5
|
|
|
5
|
1
|
1412
|
my $class = shift; |
28
|
5
|
|
|
|
|
26
|
my $self = bless {members => []}, $class; |
29
|
|
|
|
|
|
|
|
30
|
5
|
|
|
|
|
28
|
$self->_check(); |
31
|
3
|
|
|
|
|
16
|
$self->_initialize; |
32
|
|
|
|
|
|
|
|
33
|
3
|
|
|
|
|
15
|
return $self; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub _check { |
37
|
2
|
|
|
2
|
|
4
|
my $self = shift; |
38
|
2
|
100
|
|
|
|
5
|
Date::Simple::today() <= Acme::MomoiroClover::Z::change_date() or croak('MomoiroClover is obsolete. Please use Acme::MomoiroClover::Z '); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub members { |
42
|
5
|
|
|
5
|
1
|
2415
|
my ($self, $type, @members) = @_; |
43
|
5
|
50
|
|
|
|
23
|
@members = @{$self->{members}} unless @members; |
|
5
|
|
|
|
|
22
|
|
44
|
|
|
|
|
|
|
|
45
|
5
|
100
|
|
|
|
28
|
return @members unless $type; |
46
|
|
|
|
|
|
|
|
47
|
3
|
100
|
|
|
|
28
|
if ($type eq 'active') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
48
|
1
|
|
|
|
|
4
|
return grep {!$_->graduate_date} @members; |
|
11
|
|
|
|
|
297
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
elsif ($type eq 'graduate') { |
51
|
1
|
|
|
|
|
3
|
return grep {$_->graduate_date} @members; |
|
11
|
|
|
|
|
127
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
elsif ($type->isa('Date::Simple')) { |
54
|
11
|
50
|
100
|
|
|
399
|
return grep { |
55
|
1
|
|
|
|
|
47
|
$_->join_date <= $type and |
56
|
|
|
|
|
|
|
(!$_->graduate_date or $type <= $_->graduate_date) |
57
|
|
|
|
|
|
|
} @members; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub sort { |
62
|
0
|
|
|
0
|
1
|
0
|
my ($self, $type, $order, @members) = @_; |
63
|
0
|
0
|
|
|
|
0
|
@members = $self->members unless @members; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# order by desc if $order is true |
66
|
0
|
0
|
|
|
|
0
|
if ($order) { |
67
|
0
|
|
|
|
|
0
|
return sort {$b->$type <=> $a->$type} @members; |
|
0
|
|
|
|
|
0
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
else { |
70
|
0
|
|
|
|
|
0
|
return sort {$a->$type <=> $b->$type} @members; |
|
0
|
|
|
|
|
0
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub select { |
75
|
0
|
|
|
0
|
1
|
0
|
my ($self, $type, $number, $operator, @members) = @_; |
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
0
|
$self->_die('invalid operator was passed in') |
78
|
0
|
0
|
|
|
|
0
|
unless grep {$operator eq $_} qw(== >= <= > <); |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
0
|
@members = $self->members unless @members; |
81
|
0
|
|
|
|
|
0
|
my $compare = eval "(sub { \$number $operator \$_[0] })"; |
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
0
|
return grep { $compare->($_->$type) } @members; |
|
0
|
|
|
|
|
0
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub _initialize { |
87
|
3
|
|
|
3
|
|
42
|
my $self = shift; |
88
|
|
|
|
|
|
|
|
89
|
3
|
|
|
|
|
9
|
for my $member (@members) { |
90
|
33
|
|
|
|
|
74
|
my $module_name = 'Acme::MomoiroClover::Members::'.$member; |
91
|
|
|
|
|
|
|
|
92
|
33
|
|
|
|
|
2146
|
eval qq|require $module_name;|; |
93
|
33
|
|
|
|
|
105
|
push @{$self->{members}}, $module_name->new; |
|
33
|
|
|
|
|
304
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
3
|
|
|
|
|
7
|
return 1; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub _die { |
100
|
0
|
|
|
0
|
|
|
my ($self, $message) = @_; |
101
|
0
|
|
|
|
|
|
Carp::croak($message); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
__END__ |