line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package API::BigBlueButton::Response; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
API::BigBlueButton::Response - processing of API responses |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=cut |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
68
|
use 5.008008; |
|
3
|
|
|
|
|
13
|
|
10
|
3
|
|
|
3
|
|
19
|
use strict; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
64
|
|
11
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
17
|
|
|
3
|
|
|
|
|
111
|
|
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
1384
|
use XML::Fast; |
|
3
|
|
|
|
|
47708
|
|
|
3
|
|
|
|
|
941
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = "0.015"; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 VERSION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
version 0.015 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=over |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=item B |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Constructor. |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$res |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
HTTP::Response object. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=cut |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub new { |
38
|
0
|
|
|
0
|
1
|
|
my ( $class, $res ) = @_; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $success = $res->is_success; |
41
|
0
|
0
|
|
|
|
|
my $xml = $success ? $res->decoded_content : ''; |
42
|
0
|
0
|
|
|
|
|
my $error = $success ? '' : $res->decoded_content; |
43
|
0
|
|
|
|
|
|
my $status = $res->status_line; |
44
|
|
|
|
|
|
|
|
45
|
0
|
0
|
|
|
|
|
my $parsed_response = $xml ? xml2hash( $xml, attr => '' ) : {}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return bless( |
48
|
|
|
|
|
|
|
{ |
49
|
|
|
|
|
|
|
success => $success, |
50
|
|
|
|
|
|
|
xml => $xml, |
51
|
|
|
|
|
|
|
error => $error, |
52
|
0
|
0
|
|
|
|
|
response => $parsed_response->{response} ? $parsed_response->{response} : $parsed_response, |
53
|
|
|
|
|
|
|
status => $status, |
54
|
|
|
|
|
|
|
}, $class |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item B |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Returns original XML answer. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub xml { |
65
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return $self->{xml}; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item B |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Returns 1 if request succeeded, 0 otherwise. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub success { |
77
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
return $self->{success}; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item B |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Returns munged response from service. According to method, it can be scalar, hashref of arrayref. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub response { |
89
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return $self->{response}; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item B |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Returns munged error text. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub error { |
101
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
return $self->{error}; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item B |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Returns response status line. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub status { |
113
|
0
|
|
|
0
|
1
|
|
my ( $self ) = @_; |
114
|
|
|
|
|
|
|
|
115
|
0
|
|
|
|
|
|
return $self->{status}; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
__END__ |