line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::2zicon; |
2
|
3
|
|
|
3
|
|
72236
|
use 5.008001; |
|
3
|
|
|
|
|
6
|
|
3
|
3
|
|
|
3
|
|
9
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
43
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
57
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
10
|
use Carp qw(croak); |
|
3
|
|
|
|
|
2
|
|
|
3
|
|
|
|
|
143
|
|
7
|
3
|
|
|
3
|
|
1474
|
use DateTime; |
|
3
|
|
|
|
|
138881
|
|
|
3
|
|
|
|
|
985
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = "0.7"; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my @members = qw( |
12
|
|
|
|
|
|
|
MatobaKarin |
13
|
|
|
|
|
|
|
NakamuraAkari |
14
|
|
|
|
|
|
|
NemotoNagi |
15
|
|
|
|
|
|
|
OkumuraNonoka |
16
|
|
|
|
|
|
|
ShigematsuYuka |
17
|
|
|
|
|
|
|
SuyamaEmiri |
18
|
|
|
|
|
|
|
TsurumiMoe |
19
|
|
|
|
|
|
|
OtsukaMiyu |
20
|
|
|
|
|
|
|
YamatoAo |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
2
|
|
|
2
|
1
|
19
|
my $class = shift; |
25
|
2
|
|
|
|
|
8
|
my $self = bless {members => []}, $class; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
9
|
$self->_initialize; |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
|
|
5
|
return $self; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub members { |
33
|
2
|
|
|
2
|
1
|
10
|
my ($self, $type, @members) = @_; |
34
|
2
|
50
|
|
|
|
9
|
@members = @{$self->{members}} unless @members; |
|
2
|
|
|
|
|
9
|
|
35
|
|
|
|
|
|
|
|
36
|
2
|
50
|
|
|
|
16
|
return @members unless $type; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub sort { |
40
|
0
|
|
|
0
|
1
|
0
|
my ($self, $type, $order, @members) = @_; |
41
|
0
|
0
|
|
|
|
0
|
@members = $self->members unless @members; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# order by desc if $order is true |
44
|
0
|
0
|
|
|
|
0
|
if ($order) { |
45
|
0
|
|
|
|
|
0
|
return sort {$b->$type <=> $a->$type} @members; |
|
0
|
|
|
|
|
0
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
else { |
48
|
0
|
|
|
|
|
0
|
return sort {$a->$type <=> $b->$type} @members; |
|
0
|
|
|
|
|
0
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub select { |
53
|
0
|
|
|
0
|
1
|
0
|
my ($self, $type, $number, $operator, @members) = @_; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
$self->_die('invalid operator was passed in') |
56
|
0
|
0
|
|
|
|
0
|
unless grep {$operator eq $_} qw(== >= <= > <); |
|
0
|
|
|
|
|
0
|
|
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
0
|
@members = $self->members unless @members; |
59
|
0
|
|
|
|
|
0
|
my $compare = eval "(sub { \$number $operator \$_[0] })"; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
return grep { $compare->($_->$type) } @members; |
|
0
|
|
|
|
|
0
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub _initialize { |
65
|
2
|
|
|
2
|
|
2
|
my $self = shift; |
66
|
|
|
|
|
|
|
|
67
|
2
|
|
|
|
|
4
|
for my $member (@members) { |
68
|
18
|
|
|
|
|
31
|
my $module_name = 'Acme::2zicon::'.$member; |
69
|
|
|
|
|
|
|
|
70
|
18
|
|
|
|
|
989
|
eval qq|require $module_name;|; |
71
|
18
|
|
|
|
|
44
|
push @{$self->{members}}, $module_name->new; |
|
18
|
|
|
|
|
156
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
4
|
return 1; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub _die { |
78
|
0
|
|
|
0
|
|
|
my ($self, $message) = @_; |
79
|
0
|
|
|
|
|
|
Carp::croak($message); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
__END__ |