File Coverage

blib/lib/OAuth/Lite2/Agent.pm
Criterion Covered Total %
statement 9 17 52.9
branch 0 2 0.0
condition n/a
subroutine 3 5 60.0
pod 2 2 100.0
total 14 26 53.8


line stmt bran cond sub pod time code
1             package OAuth::Lite2::Agent;
2              
3 1     1   6 use strict;
  1         2  
  1         25  
4 1     1   3 use warnings;
  1         1  
  1         18  
5              
6 1     1   539 use LWP::UserAgent;
  1         15755  
  1         116  
7              
8             =head1 NAME
9              
10             OAuth::Lite2::Client::Agent - Base class of preset-agents.
11              
12             =head1 SYNOPSIS
13              
14             my $agent = OAuth::Lite2::Client::Agent->new;
15             my $res = $agent->request( $req );
16              
17             =head1 DESCRIPTION
18              
19             Base class of preset-agents.
20              
21             =head1 METHODS
22              
23             =head2 new (%args)
24              
25             Constructor you can set 'agent' that has same 'request' interface method as LWP::UserAgent.
26             If you omit that, a simple LWP::UserAgent object is set by default.
27              
28             my $agent = $class->new( agent => YourCustomAgent->new );
29              
30             =cut
31              
32             sub new {
33 0     0 1   my $class = shift;
34 0           my $self = bless { @_ }, $class;
35 0 0         unless ($self->{agent}) {
36 0           $self->{agent} = LWP::UserAgent->new;
37             $self->{agent}->agent(
38 0           join "/",
39             __PACKAGE__,
40             $OAuth::Lite2::Client::VERSION
41             );
42             }
43 0           return $self;
44             }
45              
46             =head2 request ($req)
47              
48             Returns L object.
49              
50             =cut
51              
52             sub request {
53 0     0 1   my ($self, $req) = @_;
54 0           return $self->{agent}->request($req);
55             }
56              
57             1;
58              
59             =head1 SEE ALSO
60              
61             L,
62             L
63              
64             =head1 AUTHOR
65              
66             Lyo Kato, C
67              
68             =head1 COPYRIGHT AND LICENSE
69              
70             This library is free software; you can redistribute it and/or modify
71             it under the same terms as Perl itself, either Perl version 5.8.8 or,
72             at your option, any later version of Perl 5 you may have available.
73              
74             =cut