line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::RPC::UA; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
XML::RPC::UA - Base class for XML::RPC UserAgent |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Generic usage |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
use XML::RPC::Fast; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $client = XML::RPC::Fast->new( |
14
|
|
|
|
|
|
|
$uri, |
15
|
|
|
|
|
|
|
ua => XML::RPC::UA::LWP->new( |
16
|
|
|
|
|
|
|
timeout => 10, |
17
|
|
|
|
|
|
|
ua => 'YourApp/0.01', # default User-Agent http-header |
18
|
|
|
|
|
|
|
), |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
1362
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
24
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
25
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
62
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Base class for encoders |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
5
|
use XML::RPC::Fast (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
118
|
|
30
|
|
|
|
|
|
|
our $VERSION = $XML::RPC::Fast::VERSION; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 METHODS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
The following methods should be implemented |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 async () |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Should return true, if useragent is asyncronous, false otherwise |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=cut |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
|
sub async { 0 } |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 call ( $method, $uri, body => $body, headers => { http-headers }, cb => $cb->( $response ) ); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Should process HTTP-request to C<$uri>, using C<$method>, passing C<$headers> and C<$body>, receive response, and invoke $cb with HTTP::Response object |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub call { |
53
|
0
|
|
|
0
|
1
|
|
my ($self, $method, $url, %args) = @_; |
54
|
0
|
0
|
|
|
|
|
$args{cb} or croak "cb required for useragent"; |
55
|
|
|
|
|
|
|
# ... |
56
|
|
|
|
|
|
|
#$args{cb}( HTTP::Response->new() ); |
57
|
0
|
|
|
|
|
|
return; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Copyright (c) 2008-2009 Mons Anderson. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
65
|
|
|
|
|
|
|
under the same terms as Perl itself. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Mons Anderson, C<< >> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=cut |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |