line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::ResultSet; |
2
|
1
|
|
|
1
|
|
61343
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
4
|
1
|
|
|
1
|
|
13
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.002'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new |
9
|
|
|
|
|
|
|
{ |
10
|
1
|
|
|
1
|
1
|
5
|
my ($class) = @_; |
11
|
1
|
|
|
|
|
21
|
return bless [], $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub make_wrappers |
15
|
|
|
|
|
|
|
{ |
16
|
0
|
|
|
0
|
1
|
0
|
my ($class, @methods ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
0
|
$class->make_wrappers_for_all(@methods); |
19
|
0
|
|
|
|
|
0
|
$class->make_wrappers_for_has(@methods); |
20
|
0
|
|
|
|
|
0
|
$class->make_wrappers_for_get(@methods); |
21
|
0
|
|
|
|
|
0
|
$class->make_wrappers_for_get_not(@methods); |
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
return; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub make_wrappers_for_get |
27
|
|
|
|
|
|
|
{ |
28
|
1
|
|
|
1
|
1
|
7
|
my ($class, @methods) = @_; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $generator = sub { |
31
|
1
|
|
|
1
|
|
2
|
my ($methodname) = @_; |
32
|
|
|
|
|
|
|
return sub { |
33
|
3
|
|
|
3
|
|
5
|
return grep { $_->$methodname() } @{$_[0]}; |
|
6
|
|
|
|
|
166
|
|
|
3
|
|
|
|
|
7
|
|
34
|
1
|
|
|
|
|
3
|
}; |
35
|
1
|
|
|
|
|
4
|
}; |
36
|
|
|
|
|
|
|
|
37
|
1
|
|
|
|
|
3
|
return $class->_generate_methods( 'get', $generator, @methods ); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub make_wrappers_for_get_not |
41
|
|
|
|
|
|
|
{ |
42
|
1
|
|
|
1
|
1
|
7
|
my ($class, @methods) = @_; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $generator = sub { |
45
|
1
|
|
|
1
|
|
2
|
my ($methodname) = @_; |
46
|
|
|
|
|
|
|
return sub { |
47
|
3
|
|
|
3
|
|
1537
|
return grep { ! $_->$methodname() } @{$_[0]}; |
|
6
|
|
|
|
|
164
|
|
|
3
|
|
|
|
|
8
|
|
48
|
1
|
|
|
|
|
3
|
}; |
49
|
1
|
|
|
|
|
3
|
}; |
50
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
3
|
return $class->_generate_methods( 'get_not', $generator, @methods ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub make_wrappers_for_has |
55
|
|
|
|
|
|
|
{ |
56
|
1
|
|
|
1
|
1
|
7
|
my ($class, @methods) = @_; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my $generator = sub { |
59
|
1
|
|
|
1
|
|
2
|
my ($methodname) = @_; |
60
|
|
|
|
|
|
|
return sub { |
61
|
3
|
|
|
3
|
|
6
|
for( @{$_[0]} ) { |
|
3
|
|
|
|
|
7
|
|
62
|
5
|
100
|
|
|
|
113
|
if( $_->$methodname() ) { |
63
|
2
|
|
|
|
|
110
|
return 1; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
} |
66
|
1
|
|
|
|
|
48
|
return 0; |
67
|
1
|
|
|
|
|
3
|
}; |
68
|
1
|
|
|
|
|
5
|
}; |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
3
|
return $class->_generate_methods( 'has', $generator, @methods ); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub make_wrappers_for_all |
74
|
|
|
|
|
|
|
{ |
75
|
1
|
|
|
1
|
1
|
81
|
my ($class, @methods) = @_; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
my $generator = sub { |
78
|
1
|
|
|
1
|
|
2
|
my ($methodname) = @_; |
79
|
|
|
|
|
|
|
return sub { |
80
|
3
|
|
|
3
|
|
5
|
for( @{$_[0]} ) { |
|
3
|
|
|
|
|
7
|
|
81
|
4
|
100
|
|
|
|
76
|
if( ! $_->$methodname() ) { |
82
|
2
|
|
|
|
|
106
|
return 0; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
1
|
|
|
|
|
77
|
return 1; |
86
|
1
|
|
|
|
|
3
|
}; |
87
|
1
|
|
|
|
|
5
|
}; |
88
|
|
|
|
|
|
|
|
89
|
1
|
|
|
|
|
6
|
return $class->_generate_methods( 'all', $generator, @methods ); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub _generate_methods |
93
|
|
|
|
|
|
|
{ |
94
|
4
|
|
|
4
|
|
9
|
my ($class, $prefix, $generator, @methods) = @_; |
95
|
|
|
|
|
|
|
|
96
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; ## no critic (ProhibitNoStrict) |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
218
|
|
97
|
4
|
|
|
|
|
7
|
foreach my $name (@methods) { |
98
|
4
|
|
|
|
|
5
|
my $wrappername = $name; |
99
|
4
|
|
|
|
|
11
|
$wrappername =~ s/is_//; |
100
|
4
|
|
|
|
|
8
|
$wrappername = "${class}::${prefix}_${wrappername}"; |
101
|
4
|
50
|
|
|
|
6
|
if( ! defined &{$wrappername} ) { |
|
4
|
|
|
|
|
16
|
|
102
|
4
|
|
|
|
|
9
|
*{$wrappername} = $generator->($name); |
|
4
|
|
|
|
|
15
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
4
|
|
|
|
|
11
|
return; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub add |
111
|
|
|
|
|
|
|
{ |
112
|
5
|
|
|
5
|
1
|
777
|
my ($self, $obj) = @_; |
113
|
5
|
|
|
|
|
8
|
push @{$self}, $obj; |
|
5
|
|
|
|
|
9
|
|
114
|
5
|
|
|
|
|
11
|
return $self; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub clear |
118
|
|
|
|
|
|
|
{ |
119
|
1
|
|
|
1
|
1
|
557
|
my ($self) = @_; |
120
|
1
|
|
|
|
|
3
|
@{$self} = (); |
|
1
|
|
|
|
|
2
|
|
121
|
1
|
|
|
|
|
4
|
return 1; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
sub count |
125
|
|
|
|
|
|
|
{ |
126
|
4
|
|
|
4
|
1
|
1705
|
my ($self) = @_; |
127
|
4
|
|
|
|
|
6
|
return scalar @{$self}; |
|
4
|
|
|
|
|
20
|
|
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub contents |
131
|
|
|
|
|
|
|
{ |
132
|
3
|
|
|
3
|
1
|
50
|
my ($self) = @_; |
133
|
3
|
|
|
|
|
4
|
return @{$self}; |
|
3
|
|
|
|
|
12
|
|
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |
137
|
|
|
|
|
|
|
__END__ |