| 1 | package OAuth::Lite2::Agent; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use LWP::UserAgent; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | =head1 NAME | ||||||||||
| 9 | |||||||||||
| 10 | OAuth::Lite2::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 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 33 | 0 | my $class = shift; | |||||||||
| 34 | 0 | my $self = bless { @_ }, $class; | |||||||||
| 35 | 0 | ▶ | unless ($self->{agent}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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<HTTP::Response> object. | ||||||||||
| 49 | |||||||||||
| 50 | =cut | ||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | sub request { | ||||||||
|
Subroutine
request: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 53 | 0 | my ($self, $req) = @_; | |||||||||
| 54 | 0 | return $self->{agent}->request($req); | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | 1 | 1; | |||||||||
| 58 | |||||||||||
| 59 | =head1 SEE ALSO | ||||||||||
| 60 | |||||||||||
| 61 | L<OAuth::Lite2::Client::Agent::Dump>, | ||||||||||
| 62 | L<OAuth::Lite2::Client::Agent::Strict> | ||||||||||
| 63 | |||||||||||
| 64 | =head1 AUTHOR | ||||||||||
| 65 | |||||||||||
| 66 | Lyo Kato, C<lyo.kato _at_ gmail.com> | ||||||||||
| 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 | ||||||||||