| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WWW::FCM::HTTP::Response; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
16
|
use strict; |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
68
|
|
|
4
|
3
|
|
|
3
|
|
11
|
use warnings; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
71
|
|
|
5
|
3
|
|
|
3
|
|
11
|
use JSON qw(decode_json); |
|
|
3
|
|
|
|
|
5
|
|
|
|
3
|
|
|
|
|
19
|
|
|
6
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
|
7
|
3
|
|
|
|
|
13
|
new => 0, |
|
8
|
|
|
|
|
|
|
ro => [qw/http_response content is_success sent_reg_ids/], |
|
9
|
3
|
|
|
3
|
|
224
|
); |
|
|
3
|
|
|
|
|
5
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
3
|
|
|
3
|
|
1206
|
use WWW::FCM::HTTP::Response::ResultSet; |
|
|
3
|
|
|
|
|
6
|
|
|
|
3
|
|
|
|
|
834
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
|
14
|
6
|
|
|
6
|
0
|
41
|
my ($class, $http_response) = @_; |
|
15
|
|
|
|
|
|
|
|
|
16
|
6
|
|
|
|
|
66
|
my $is_success = $http_response->is_success; |
|
17
|
6
|
|
|
|
|
159
|
my $content = $http_response->content; |
|
18
|
6
|
|
|
|
|
94
|
my $req_content = decode_json($http_response->request->content); |
|
19
|
|
|
|
|
|
|
|
|
20
|
6
|
|
|
|
|
245
|
my $sent_reg_ids = []; |
|
21
|
6
|
100
|
|
|
|
26
|
if ($is_success) { |
|
22
|
5
|
|
|
|
|
127
|
$content = decode_json $content; |
|
23
|
|
|
|
|
|
|
|
|
24
|
5
|
100
|
|
|
|
21
|
if (exists $content->{multicast_id}) { |
|
25
|
4
|
|
|
|
|
10
|
$sent_reg_ids = $req_content->{registration_ids}; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
else { |
|
29
|
1
|
|
|
|
|
12
|
$content = { error => $content }; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
6
|
|
|
|
|
124
|
bless { |
|
33
|
|
|
|
|
|
|
is_success => $is_success, |
|
34
|
|
|
|
|
|
|
content => $content, |
|
35
|
|
|
|
|
|
|
sent_reg_ids => $sent_reg_ids, |
|
36
|
|
|
|
|
|
|
http_response => $http_response, |
|
37
|
|
|
|
|
|
|
}, $class; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub success { |
|
41
|
6
|
|
|
6
|
0
|
3495
|
shift->content->{success}; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub failure { |
|
45
|
6
|
|
|
6
|
0
|
3844
|
shift->content->{failure}; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub message_id { |
|
49
|
6
|
|
|
6
|
0
|
4374
|
shift->content->{message_id}; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub multicast_id { |
|
53
|
6
|
|
|
6
|
0
|
3994
|
shift->content->{multicast_id}; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub canonical_ids { |
|
57
|
6
|
|
|
6
|
0
|
4140
|
shift->content->{canonical_ids}; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub error { |
|
61
|
6
|
|
|
6
|
0
|
16278
|
shift->content->{error}; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub has_error { |
|
65
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
|
66
|
0
|
0
|
|
|
|
0
|
return 1 unless $self->is_success; |
|
67
|
0
|
0
|
|
|
|
0
|
$self->error ? 1 : 0; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub results { |
|
71
|
4
|
|
|
4
|
0
|
2792
|
my $self = shift; |
|
72
|
4
|
|
50
|
|
|
15
|
my $results = $self->content->{results} || return; |
|
73
|
4
|
|
|
|
|
48
|
WWW::FCM::HTTP::Response::ResultSet->new($results, $self->sent_reg_ids); |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
0
|
|
|
sub DESTROY {}; |
|
77
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
78
|
1
|
|
|
1
|
|
1137
|
(my $method = our $AUTOLOAD) =~ s/.*:://; |
|
79
|
3
|
|
|
3
|
|
16
|
no strict 'refs'; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
96
|
|
|
80
|
1
|
|
|
|
|
6
|
*{$AUTOLOAD} = sub { |
|
81
|
3
|
|
|
3
|
|
12
|
use strict; |
|
|
3
|
|
|
|
|
12
|
|
|
|
3
|
|
|
|
|
191
|
|
|
82
|
6
|
|
|
6
|
|
6094
|
my $self = shift; |
|
83
|
6
|
|
|
|
|
38
|
$self->{http_response}->$method(@_); |
|
84
|
1
|
|
|
|
|
17
|
}; |
|
85
|
1
|
|
|
|
|
4
|
goto &$AUTOLOAD; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |