| 1 | # Idea of RequestAgent is cut-n-paste from lwp-request | ||||||||||||||||||||
| 2 | # | ||||||||||||||||||||
| 3 | # If you know a better way of doing this, please let me know. | ||||||||||||||||||||
| 4 | # | ||||||||||||||||||||
| 5 | # We make our own specialization of LWP::UserAgent that asks for | ||||||||||||||||||||
| 6 | # user/password if document is protected. | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | # $Id: RequestAgent.pm,v 1.2 2000/04/10 03:49:57 mah Exp $ | ||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | package Image::Grab::RequestAgent; | ||||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 8 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 8 | ▶ | use vars qw($VERSION @ISA @EXPORT_OK); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | 8 | require LWP::UserAgent; | |||||||||||||||||||
| 15 | 8 | @ISA = qw(LWP::UserAgent Exporter); | |||||||||||||||||||
| 16 | 8 | @EXPORT_OK = qw( | |||||||||||||||||||
| 17 | &new | ||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||
| 19 | 8 | $VERSION='1.01'; | |||||||||||||||||||
| 20 | |||||||||||||||||||||
| 21 | 8 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 8 | my %realm; | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 11 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 26 | 11 | my $that = shift; | |||||||||||||||||||
| 27 | 11 | ▶ | my $class = ref($that) || $that; | ||||||||||||||||||
|
Condition33%1/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table33%1/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 28 | 11 | my $self = LWP::UserAgent->new(@_); | |||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 11 | $self->env_proxy; | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | 11 | bless $self, $class; | |||||||||||||||||||
| 33 | 11 | return $self; | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | 0 | ▶ | sub register_realm { | ||||||||||||||||||
|
Subroutine
register_realm: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 37 | 0 | my $self = shift; | |||||||||||||||||||
| 38 | 0 | my $realm = shift; | |||||||||||||||||||
| 39 | 0 | my $user = shift; | |||||||||||||||||||
| 40 | 0 | my $pass = shift; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | $realm{$realm}->{user} = $user; | |||||||||||||||||||
| 43 | 0 | $realm{$realm}->{pass} = $pass; | |||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | ▶ | sub get_basic_credentials { | ||||||||||||||||||
|
Subroutine
get_basic_credentials: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 47 | 0 | my ($self, $realm) = @_; | |||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 0 | ▶ | if(defined $realm{$realm}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 50 | return ($realm{$realm}->{user}, | ||||||||||||||||||||
| 51 | 0 | $realm{$realm}->{pass}); | |||||||||||||||||||
| 52 | } | ||||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 8 | 1; | |||||||||||||||||||