| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WebService::30Boxes::API::Response; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
33
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
29
|
|
|
5
|
1
|
|
|
1
|
|
27604
|
use HTTP::Response; |
|
|
1
|
|
|
|
|
9903
|
|
|
|
1
|
|
|
|
|
345
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @ISA = qw(HTTP::Response); |
|
8
|
|
|
|
|
|
|
our $VERSION = '1.05'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
|
11
|
0
|
|
|
0
|
1
|
|
my ($class, $args) = @_; |
|
12
|
0
|
|
|
|
|
|
my $self = new HTTP::Response; |
|
13
|
0
|
|
|
|
|
|
$self->{'error_code'} = undef; |
|
14
|
0
|
|
|
|
|
|
$self->{'error_msg'} = undef; |
|
15
|
0
|
|
|
|
|
|
$self->{'success'} = undef; |
|
16
|
0
|
|
|
|
|
|
$self->{'_xml'} = undef; |
|
17
|
0
|
|
|
|
|
|
bless $self, $class; |
|
18
|
0
|
|
|
|
|
|
return $self; |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub set_error { |
|
22
|
0
|
|
|
0
|
0
|
|
my ($self, $code, $msg) = @_; |
|
23
|
0
|
|
|
|
|
|
$self->{'success'} = 0; |
|
24
|
0
|
|
|
|
|
|
$self->{'error_code'} = $code; |
|
25
|
0
|
|
|
|
|
|
$self->{'error_msg'} = $msg; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub set_success { |
|
29
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
30
|
0
|
|
|
|
|
|
$self->{'success'} = 1; |
|
31
|
0
|
|
|
|
|
|
$self->{'error_code'} = undef; |
|
32
|
0
|
|
|
|
|
|
$self->{'error_msg'} = undef; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub reply { |
|
36
|
0
|
|
|
0
|
1
|
|
my ($self, $xml) = @_; |
|
37
|
0
|
0
|
|
|
|
|
$self->{'_xml'} = $xml if($xml); |
|
38
|
0
|
|
|
|
|
|
return $self->{'_xml'}; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
|
42
|
|
|
|
|
|
|
#################### main pod documentation begin ################### |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 NAME |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
WebService::30Boxes::API::Response - Response from 30Boxes REST API |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
use WebService::30Boxes::API; |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# You always have to provide your api_key |
|
53
|
|
|
|
|
|
|
my $boxes = WebService::30Boxes::API->(api_key => 'your_api_key'); |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Then you might want to lookup a user and print some info |
|
56
|
|
|
|
|
|
|
my $result = $boxes->call('user.FindById', { id => 47 }); |
|
57
|
|
|
|
|
|
|
if($result->{'success'}) { |
|
58
|
|
|
|
|
|
|
my $user = $result->reply->{'user'}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
print $user->{'firstName'}, " ", |
|
61
|
|
|
|
|
|
|
$user->{'lastName'}, " joined 30Boxes at ", |
|
62
|
|
|
|
|
|
|
$user->{'createDate'},"\n"; |
|
63
|
|
|
|
|
|
|
} else { |
|
64
|
|
|
|
|
|
|
print "An error occured ($result->{'error_code'}: ". |
|
65
|
|
|
|
|
|
|
"$result->{'error_msg'})"; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
C- Response from 30Boxes API |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
The response object is basically a L class, with a few |
|
73
|
|
|
|
|
|
|
things added. These keys can be queried: |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over 5 |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item success |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Was the call succesful? |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item error_code |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
If not succesful, what error code did we get? |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item error_msg |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
And the error message |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 METHODS |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head3 reply |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
C returns the result of L's parsing of the 30Boxes |
|
96
|
|
|
|
|
|
|
reply. See the example above. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
L, L, L |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 BUGS |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Please report any bugs to L |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 AUTHOR |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
M. Blom, |
|
109
|
|
|
|
|
|
|
Eblom@cpan.orgE, |
|
110
|
|
|
|
|
|
|
L |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Copyright (C) 2006 by M. Blom |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
117
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.8.6 or, |
|
118
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
|
121
|
|
|
|
|
|
|
|