| 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 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 25 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 26 | |||||||||||
| 27 | # Base class for encoders | ||||||||||
| 28 | |||||||||||
| 29 | 1 | ▶ | use XML::RPC::Fast (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 1 | 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 | ▶ | sub async { 0 } | ||||||||
|
Subroutine
async: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 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 | 0 | ▶ | sub call { | ||||||||
|
Subroutine
call: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 53 | 0 | my ($self, $method, $url, %args) = @_; | |||||||||
| 54 | 0 | ▶ | $args{cb} or croak "cb required for useragent"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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<< <mons@cpan.org> >> | ||||||||||
| 70 | |||||||||||
| 71 | =cut | ||||||||||
| 72 | |||||||||||
| 73 | 1 | 1; | |||||||||