line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Google::Cloud::Messaging::Response; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
21
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
107
|
|
4
|
4
|
|
|
4
|
|
20
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
123
|
|
5
|
4
|
|
|
4
|
|
19
|
use JSON qw(decode_json); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
20
|
|
6
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
2783
|
use WWW::Google::Cloud::Messaging::Response::ResultSet; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
685
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
5
|
|
|
5
|
1
|
16
|
my ($class, $http_response) = @_; |
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
|
|
58
|
my $is_success = $http_response->is_success; |
13
|
5
|
|
|
|
|
135
|
my $content = $http_response->content; |
14
|
5
|
|
|
|
|
102
|
my $reg_ids = []; |
15
|
|
|
|
|
|
|
|
16
|
5
|
100
|
|
|
|
29
|
if ($is_success) { |
17
|
4
|
|
|
|
|
191
|
$content = decode_json $content; |
18
|
4
|
|
|
|
|
20
|
$reg_ids = decode_json($http_response->request->content)->{registration_ids}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
else { |
21
|
1
|
|
|
|
|
29
|
$content = { error => $content }; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
5
|
|
|
|
|
359
|
bless { |
25
|
|
|
|
|
|
|
is_success => $is_success, |
26
|
|
|
|
|
|
|
content => $content, |
27
|
|
|
|
|
|
|
reg_ids => $reg_ids, |
28
|
|
|
|
|
|
|
http_response => $http_response, |
29
|
|
|
|
|
|
|
}, $class; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub http_response { |
33
|
15
|
|
|
15
|
0
|
198
|
shift->{http_response}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub is_success { |
37
|
5
|
|
|
5
|
1
|
78
|
shift->{is_success}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
for my $method (qw{success failure multicast_id canonical_ids error}) { |
41
|
4
|
|
|
4
|
|
30
|
no strict 'refs'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
141
|
|
42
|
|
|
|
|
|
|
*{$method} = sub { |
43
|
4
|
|
|
4
|
|
20
|
use strict; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
634
|
|
44
|
25
|
|
|
25
|
|
22077
|
shift->{content}{$method}; |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub results { |
49
|
4
|
|
|
4
|
1
|
11137
|
my $self = shift; |
50
|
4
|
|
50
|
|
|
25
|
my $results = $self->{content}{results} || return; |
51
|
4
|
|
|
|
|
88
|
WWW::Google::Cloud::Messaging::Response::ResultSet->new($results, $self->{reg_ids}); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
0
|
|
|
sub DESTROY {} |
55
|
|
|
|
|
|
|
sub AUTOLOAD { |
56
|
1
|
|
|
1
|
|
20
|
(my $method = our $AUTOLOAD) =~ s/.*:://; |
57
|
4
|
|
|
4
|
|
20
|
no strict 'refs'; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
164
|
|
58
|
1
|
|
|
|
|
15
|
*{$AUTOLOAD} = sub { |
59
|
4
|
|
|
4
|
|
19
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
292
|
|
60
|
5
|
|
|
5
|
|
11
|
my $self = shift; |
61
|
5
|
|
|
|
|
52
|
$self->{http_response}->$method(@_); |
62
|
1
|
|
|
|
|
11
|
}; |
63
|
1
|
|
|
|
|
14
|
goto &$AUTOLOAD; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
__END__ |