line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Google::Cloud::Messaging::Response; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
59
|
|
4
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
62
|
|
5
|
2
|
|
|
2
|
|
9
|
use JSON qw(decode_json); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
9
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1232
|
use WWW::Google::Cloud::Messaging::Response::ResultSet; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
363
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
0
|
|
|
0
|
1
|
|
my ($class, $http_response) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my $is_success = $http_response->is_success; |
13
|
0
|
|
|
|
|
|
my $content = $http_response->content; |
14
|
0
|
|
|
|
|
|
my $reg_ids = []; |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
if ($is_success) { |
17
|
0
|
|
|
|
|
|
$content = decode_json $content; |
18
|
0
|
|
|
|
|
|
$reg_ids = decode_json($http_response->request->content)->{registration_ids}; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
else { |
21
|
0
|
|
|
|
|
|
$content = { error => $content }; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
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
|
0
|
|
|
0
|
0
|
|
shift->{http_response}; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub is_success { |
37
|
0
|
|
|
0
|
1
|
|
shift->{is_success}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
for my $method (qw{success failure multicast_id canonical_ids error}) { |
41
|
2
|
|
|
2
|
|
9
|
no strict 'refs'; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
57
|
|
42
|
|
|
|
|
|
|
*{$method} = sub { |
43
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
272
|
|
44
|
0
|
|
|
0
|
|
|
shift->{content}{$method}; |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub results { |
49
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
50
|
0
|
|
0
|
|
|
|
my $results = $self->{content}{results} || return; |
51
|
0
|
|
|
|
|
|
WWW::Google::Cloud::Messaging::Response::ResultSet->new($results, $self->{reg_ids}); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
0
|
|
|
sub DESTROY {} |
55
|
|
|
|
|
|
|
sub AUTOLOAD { |
56
|
0
|
|
|
0
|
|
|
(my $method = our $AUTOLOAD) =~ s/.*:://; |
57
|
2
|
|
|
2
|
|
9
|
no strict 'refs'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
72
|
|
58
|
0
|
|
|
|
|
|
*{$AUTOLOAD} = sub { |
59
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
133
|
|
60
|
0
|
|
|
0
|
|
|
my $self = shift; |
61
|
0
|
|
|
|
|
|
$self->{http_response}->$method(@_); |
62
|
0
|
|
|
|
|
|
}; |
63
|
0
|
|
|
|
|
|
goto &$AUTOLOAD; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
__END__ |