line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::GData::Collection; |
2
|
16
|
|
|
16
|
|
122332
|
use WebService::GData::Iterator; |
|
16
|
|
|
|
|
136
|
|
|
16
|
|
|
|
|
1997
|
|
3
|
16
|
|
|
16
|
|
1658
|
use base 'WebService::GData'; |
|
16
|
|
|
|
|
89
|
|
|
16
|
|
|
|
|
4637
|
|
4
|
16
|
|
|
16
|
|
93
|
use strict; |
|
16
|
|
|
|
|
110
|
|
|
16
|
|
|
|
|
544
|
|
5
|
16
|
|
|
16
|
|
102
|
use overload '@{}'=>'__to_string',fallback=>1; |
|
16
|
|
|
|
|
28
|
|
|
16
|
|
|
|
|
137
|
|
6
|
|
|
|
|
|
|
our $VERSION =0.01_04; |
7
|
|
|
|
|
|
|
|
8
|
284
|
|
|
284
|
|
2110
|
sub __to_string { my $this = shift;$this->{array}; }; |
|
284
|
|
|
|
|
1581
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub __init { |
11
|
50
|
|
|
50
|
|
95
|
my ($this,$array,$onset,$onget) = @_; |
12
|
50
|
100
|
|
|
|
145
|
$array = ref $array eq 'ARRAY' ? $array :[]; |
13
|
50
|
|
|
|
|
82
|
my $ar = []; |
14
|
50
|
|
|
|
|
73
|
my $obj = tie @{$ar},'WebService::GData::Iterator',$onset,$onget; |
|
50
|
|
|
|
|
276
|
|
15
|
50
|
|
|
|
|
798
|
$this->{array}=$ar; |
16
|
50
|
|
|
|
|
90
|
$obj->{ARRAY}=$array; |
17
|
|
|
|
|
|
|
|
18
|
50
|
|
|
|
|
177
|
$this->{cache}={}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub __set { |
23
|
18
|
|
|
18
|
|
42
|
my ($this,$attr,$val)=@_; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#only scalar value allowed |
26
|
18
|
50
|
33
|
|
|
139
|
return [] if(ref($val)||ref($attr)); |
27
|
|
|
|
|
|
|
|
28
|
18
|
100
|
|
|
|
90
|
if($this->{cache}->{$attr.$val}){ |
29
|
4
|
|
|
|
|
30
|
return $this->{cache}->{$attr.$val}; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
14
|
|
|
|
|
53
|
$this->{cache}->{$attr.$val}=[]; |
33
|
14
|
|
|
|
|
41
|
my @ret= (); |
34
|
14
|
|
|
|
|
31
|
foreach my $elm (@$this){ |
35
|
68
|
100
|
66
|
|
|
197
|
if($elm->$attr() && $elm->$attr()=~m/$val/) { |
36
|
12
|
|
|
|
|
65
|
push @ret,$elm; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
14
|
|
|
|
|
65
|
$this->{cache}->{$attr.$val}=\@ret; |
40
|
|
|
|
|
|
|
|
41
|
14
|
|
|
|
|
154
|
$this->{cache}->{$attr.$val} |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub __get { |
45
|
8
|
|
|
8
|
|
12
|
my ($this,$func)=@_; |
46
|
|
|
|
|
|
|
|
47
|
8
|
|
|
|
|
12
|
my @ret =(); |
48
|
8
|
|
|
|
|
10
|
my $last=$this;#don't re-insert result from static methods like attributes()... |
49
|
|
|
|
|
|
|
|
50
|
8
|
|
|
|
|
14
|
foreach my $elm (@$this){ |
51
|
8
|
|
|
|
|
23
|
my $ret = $elm->$func(); |
52
|
8
|
50
|
33
|
|
|
49
|
next if ($ret && ((!ref $ret && $ret ne $last) || (ref $ret && $ret==$last))); |
|
|
|
33
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
$last= $ret; |
54
|
0
|
|
|
|
|
0
|
push @ret,$ret; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
\@ret |
58
|
8
|
|
|
|
|
33
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
"The earth is blue like an orange."; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |