| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::GData::Node; |
|
2
|
30
|
|
|
30
|
|
38223
|
use WebService::GData; |
|
|
30
|
|
|
|
|
90
|
|
|
|
30
|
|
|
|
|
204
|
|
|
3
|
30
|
|
|
30
|
|
171
|
use base 'WebService::GData'; |
|
|
30
|
|
|
|
|
54
|
|
|
|
30
|
|
|
|
|
7217
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = 0.06; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $attributes = []; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
|
10
|
413
|
|
|
413
|
|
635
|
shift(); |
|
11
|
413
|
|
66
|
|
|
1475
|
my $package = shift() || caller; |
|
12
|
413
|
100
|
66
|
|
|
4137
|
return if ( $package->isa(__PACKAGE__) || $package eq 'main' ); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
412
|
|
|
|
|
2708
|
WebService::GData->import; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
WebService::GData::install_in_package( ['set_meta'], |
|
18
|
412
|
|
|
412
|
|
15485
|
sub { return \&set_meta; }, $package ); |
|
|
412
|
|
|
|
|
955
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#install this package in the inheritance chain |
|
21
|
|
|
|
|
|
|
#and create the default tag_name by lowering the last name of the package |
|
22
|
|
|
|
|
|
|
{ |
|
23
|
30
|
|
|
30
|
|
263
|
no strict 'refs'; |
|
|
30
|
|
|
|
|
51
|
|
|
|
30
|
|
|
|
|
5711
|
|
|
|
412
|
|
|
|
|
1502
|
|
|
24
|
412
|
|
|
|
|
478
|
push @{ $package . '::ISA' }, __PACKAGE__; |
|
|
412
|
|
|
|
|
18163
|
|
|
25
|
412
|
|
|
|
|
1621
|
my $pk = $package; |
|
26
|
412
|
|
|
|
|
2208
|
$package =~ s/.*:://; |
|
27
|
412
|
|
|
|
|
10875
|
*{ $pk . '::node_name' } = sub { |
|
28
|
72
|
|
|
72
|
|
266
|
return "\l$package"; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
412
|
|
|
|
|
4513
|
} |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub set_meta { |
|
34
|
163
|
|
|
163
|
1
|
570
|
my %data = @_; |
|
35
|
163
|
|
|
|
|
321
|
my $package = caller; |
|
36
|
163
|
50
|
|
|
|
701
|
return if ( $package eq __PACKAGE__ ); |
|
37
|
|
|
|
|
|
|
{ |
|
38
|
30
|
|
|
30
|
|
209
|
no strict 'refs'; |
|
|
30
|
|
|
|
|
69
|
|
|
|
30
|
|
|
|
|
882
|
|
|
|
163
|
|
|
|
|
323
|
|
|
39
|
30
|
|
|
30
|
|
167
|
no warnings 'redefine'; |
|
|
30
|
|
|
|
|
50
|
|
|
|
30
|
|
|
|
|
41801
|
|
|
40
|
163
|
|
|
|
|
716
|
while ( my ( $sub, $val ) = each %data ) { |
|
41
|
249
|
|
|
|
|
2502
|
*{ $package . '::' . $sub } = sub { |
|
42
|
140
|
|
|
140
|
|
754
|
return $val; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
249
|
|
|
|
|
867
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub __init { |
|
50
|
200
|
|
|
200
|
|
781
|
my ( $this, @args ) = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
200
|
|
|
|
|
29961
|
$this->{namespaces} = {}; |
|
53
|
200
|
100
|
|
|
|
659
|
if ( ref( $args[0] ) eq 'HASH' ) { |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#accept a text tag but json feed uses $t tag so adapt |
|
56
|
|
|
|
|
|
|
#for compatibility |
|
57
|
114
|
100
|
|
|
|
331
|
if ( $args[0]->{'$t'} ) { |
|
58
|
53
|
|
|
|
|
117
|
$args[0]->{'text'} = $args[0]->{'$t'}; |
|
59
|
53
|
|
|
|
|
122
|
delete $args[0]->{'$t'}; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
114
|
|
|
|
|
134
|
my %args = %{ $args[0] }; |
|
|
114
|
|
|
|
|
522
|
|
|
62
|
114
|
|
|
|
|
285
|
foreach my $attr (keys %args) { |
|
63
|
237
|
|
|
|
|
10314
|
my $val = delete $args{$attr}; |
|
64
|
237
|
|
|
|
|
362
|
$attr =~ s/\$/:/; |
|
65
|
237
|
|
|
|
|
524
|
$args{$attr} = $val; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
114
|
|
|
|
|
452
|
@args = %args; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
200
|
100
|
|
|
|
1275
|
$this->SUPER::__init(@args) if ( @args % 2 == 0 ); |
|
71
|
200
|
|
|
|
|
898
|
$this->{_children} = []; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
|
|
0
|
1
|
0
|
sub namespace_prefix { "" } |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
0
|
1
|
0
|
sub node_name { "" } |
|
77
|
|
|
|
|
|
|
|
|
78
|
0
|
|
|
0
|
1
|
0
|
sub namespace_uri { "" } |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
0
|
1
|
0
|
sub extra_namespaces { } |
|
81
|
|
|
|
|
|
|
|
|
82
|
74
|
|
|
74
|
1
|
328
|
sub attributes { $attributes } |
|
83
|
|
|
|
|
|
|
|
|
84
|
38
|
|
|
38
|
1
|
131
|
sub is_parent { 1 } |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub namespaces { |
|
87
|
18
|
|
|
18
|
1
|
25
|
my ($this) = @_; |
|
88
|
18
|
|
|
|
|
49
|
$this->{namespaces}; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub text { |
|
92
|
26
|
|
|
26
|
1
|
416
|
my ($this,@args) = @_; |
|
93
|
26
|
100
|
|
|
|
80
|
$this->{text}= $args[0] if(@args); |
|
94
|
26
|
|
|
|
|
175
|
return $this->{text}; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub child { |
|
99
|
200
|
|
|
200
|
1
|
795
|
my $this = shift; |
|
100
|
200
|
100
|
|
|
|
489
|
if ( @_ == 1 ) { |
|
101
|
153
|
|
|
|
|
183
|
my $child = shift; |
|
102
|
153
|
50
|
|
|
|
483
|
return $this |
|
103
|
|
|
|
|
|
|
if ( $this == $child ); #TODO:warn |
|
104
|
153
|
|
|
|
|
1899
|
push @{ $this->{_children} }, $child; |
|
|
153
|
|
|
|
|
368
|
|
|
105
|
153
|
|
|
|
|
655
|
return $this; |
|
106
|
|
|
|
|
|
|
} |
|
107
|
47
|
|
|
|
|
205
|
return $this->{_children}; |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub swap { |
|
111
|
0
|
|
|
0
|
1
|
0
|
my ( $this, $remove, $new ) = @_; |
|
112
|
0
|
|
|
|
|
0
|
my $i = 0; |
|
113
|
0
|
|
|
|
|
0
|
foreach my $child ( @{ $this->{_children} } ) { |
|
|
0
|
|
|
|
|
0
|
|
|
114
|
0
|
0
|
|
|
|
0
|
if ( $child == $remove ) { |
|
115
|
0
|
|
|
|
|
0
|
$this->{_children}->[$i] = $new; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
0
|
|
|
|
|
0
|
$i++; |
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub __set { |
|
122
|
7
|
|
|
7
|
|
19
|
my ( $this, $func, @args ) = @_; |
|
123
|
7
|
|
|
|
|
18
|
my $called_func= $func; |
|
124
|
|
|
|
|
|
|
|
|
125
|
7
|
|
|
|
|
9
|
my @attrs = @{ $this->attributes }; |
|
|
7
|
|
|
|
|
22
|
|
|
126
|
|
|
|
|
|
|
|
|
127
|
7
|
100
|
|
|
|
122
|
if ( !grep /^$func$/, @attrs ) { |
|
128
|
2
|
|
|
|
|
4
|
foreach my $attr (@attrs){ |
|
129
|
7
|
100
|
|
|
|
57
|
$func = $attr if($attr=~m/^.+?:$func$/); |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
7
|
100
|
|
|
|
33
|
if ( my ( $ns, $tag ) = $func =~ /^(.+?)_(.+)$/ ) { |
|
134
|
|
|
|
|
|
|
|
|
135
|
1
|
|
|
|
|
4
|
my $attr = $ns . ':' . camelcase($tag); |
|
136
|
1
|
50
|
|
|
|
14
|
if ( grep /^$attr$/, @attrs ) { |
|
137
|
0
|
|
|
|
|
0
|
$func = $attr; |
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
} |
|
140
|
7
|
|
|
|
|
23
|
my $camelize=camelcase($func); |
|
141
|
7
|
50
|
|
|
|
142
|
$this->{ $camelize } = @args == 1 ? $args[0] : \@args; |
|
142
|
|
|
|
|
|
|
|
|
143
|
7
|
|
|
|
|
27
|
_install_get_set(ref $this,$called_func,$camelize); |
|
144
|
|
|
|
|
|
|
|
|
145
|
7
|
|
|
|
|
21
|
return $this; |
|
146
|
|
|
|
|
|
|
} |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub __get { |
|
149
|
59
|
|
|
59
|
|
127
|
my ( $this, $func ) = @_; |
|
150
|
59
|
|
|
|
|
184
|
my $called_func= $func; |
|
151
|
|
|
|
|
|
|
|
|
152
|
59
|
|
|
|
|
82
|
my @attrs = @{ $this->attributes }; |
|
|
59
|
|
|
|
|
186
|
|
|
153
|
59
|
100
|
|
|
|
1282
|
if ( !grep /^$func$/, @attrs ) { |
|
154
|
14
|
|
|
|
|
32
|
foreach my $attr (@attrs){ |
|
155
|
47
|
100
|
|
|
|
431
|
$func = $attr if($attr=~m/^.+?:$func$/); |
|
156
|
|
|
|
|
|
|
} |
|
157
|
|
|
|
|
|
|
} |
|
158
|
59
|
100
|
|
|
|
264
|
if ( my ( $ns, $tag ) = $func =~ /^(.+?)_(.+)$/ ) { |
|
159
|
|
|
|
|
|
|
|
|
160
|
6
|
|
|
|
|
17
|
my $attr = $ns . ':' . camelcase($tag); |
|
161
|
6
|
50
|
|
|
|
78
|
if ( grep /$attr/, @attrs ) { |
|
162
|
0
|
|
|
|
|
0
|
$func = $attr; |
|
163
|
|
|
|
|
|
|
} |
|
164
|
|
|
|
|
|
|
} |
|
165
|
59
|
|
|
|
|
151
|
my $camelize = camelcase($func); |
|
166
|
|
|
|
|
|
|
|
|
167
|
59
|
|
|
|
|
249
|
_install_get_set(ref $this,$called_func,$camelize); |
|
168
|
|
|
|
|
|
|
|
|
169
|
59
|
|
|
|
|
9070
|
$this->{ $camelize }; |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
} |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
private _install_get_set=>sub { |
|
174
|
|
|
|
|
|
|
my ($package,$called_func,$stored_attr)=@_; |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
{ |
|
177
|
30
|
|
|
30
|
|
216
|
no strict 'refs'; |
|
|
30
|
|
|
|
|
90
|
|
|
|
30
|
|
|
|
|
7155
|
|
|
178
|
|
|
|
|
|
|
*{$package.'::'.$called_func}= sub { |
|
179
|
148
|
|
|
148
|
|
321
|
my ($this,@args) = @_; |
|
180
|
148
|
|
|
|
|
401
|
local *__ANON__=$called_func; |
|
181
|
148
|
100
|
|
|
|
325
|
if(@args>0){ |
|
182
|
2
|
50
|
|
|
|
30
|
$this->{ $stored_attr } = @args == 1 ? $args[0] : \@args; |
|
183
|
2
|
|
|
|
|
10
|
return $this; |
|
184
|
|
|
|
|
|
|
} |
|
185
|
146
|
|
|
|
|
1316
|
$this->{ $stored_attr }; |
|
186
|
|
|
|
|
|
|
}; |
|
187
|
|
|
|
|
|
|
} |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
}; |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
sub camelcase { |
|
192
|
73
|
|
|
73
|
0
|
121
|
my $str = shift; |
|
193
|
73
|
|
|
|
|
170
|
$str =~ s/_([a-z])/\U$1/g; |
|
194
|
73
|
|
|
|
|
197
|
return $str; |
|
195
|
|
|
|
|
|
|
} |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
"The earth is blue like an orange."; |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
__END__ |