| 1 | # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # vim: ts=4 sts=4 sw=4: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | package CPAN::HTTP::Credentials; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 26 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 26 | ▶ | use vars qw($USER $PASSWORD $PROXY_USER $PROXY_PASSWORD); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 26 | $CPAN::HTTP::Credentials::VERSION = $CPAN::HTTP::Credentials::VERSION = "1.9601"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | sub clear_credentials { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_credentials: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | clear_non_proxy_credentials(); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_credentials: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | clear_proxy_credentials(); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub clear_non_proxy_credentials { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_non_proxy_credentials: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | undef $USER; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_non_proxy_credentials: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | undef $PASSWORD; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub clear_proxy_credentials { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_proxy_credentials: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | ▶ | undef $PROXY_USER; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
clear_proxy_credentials: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | undef $PROXY_PASSWORD; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 2 | ▶ | sub get_proxy_credentials { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_proxy_credentials: called CC=6 SCAR=30.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_proxy_credentials: not called CC=6 SCAR=30.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | if ($PROXY_USER && $PROXY_PASSWORD) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$CPAN::HTTP::Credentials::PROXY_USER and $CPAN::HTTP::Credentials::PROXY_PASSWORD
$CPAN::HTTP::Credentials::PROXY_USER and $CPAN::HTTP::Credentials::PROXY_PASSWORD
MC/DC0%0/2
$CPAN::HTTP::Credentials::PROXY_USER and $CPAN::HTTP::Credentials::PROXY_PASSWORD
$CPAN::HTTP::Credentials::PROXY_USER
$CPAN::HTTP::Credentials::PROXY_PASSWORD
MC/DC0%0/2
$CPAN::HTTP::Credentials::PROXY_USER and $CPAN::HTTP::Credentials::PROXY_PASSWORD
$CPAN::HTTP::Credentials::PROXY_USER
$CPAN::HTTP::Credentials::PROXY_PASSWORD
Truth table33%1/3
A and B
A= $CPAN::HTTP::Credentials::PROXY_USERB= $CPAN::HTTP::Credentials::PROXY_PASSWORD
Truth table0%0/3
A and B
A= $CPAN::HTTP::Credentials::PROXY_USERB= $CPAN::HTTP::Credentials::PROXY_PASSWORD
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | return ($PROXY_USER, $PROXY_PASSWORD); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | if ( defined $CPAN::Config->{proxy_user} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
defined $CPAN::Config->{"proxy_user"} and $CPAN::Config->{"proxy_user"}
defined $CPAN::Config->{"proxy_user"} and $CPAN::Config->{"proxy_user"}
MC/DC0%0/2
defined $CPAN::Config->{"proxy_user"} and $CPAN::Config->{"proxy_user"}
defined $CPAN::Config->{"proxy_user"}
$CPAN::Config->{"proxy_user"}
MC/DC0%0/2
defined $CPAN::Config->{"proxy_user"} and $CPAN::Config->{"proxy_user"}
defined $CPAN::Config->{"proxy_user"}
$CPAN::Config->{"proxy_user"}
Truth table33%1/3
A and B
A= defined $CPAN::Config->{"proxy_user"}B= $CPAN::Config->{"proxy_user"}
Truth table0%0/3
A and B
A= defined $CPAN::Config->{"proxy_user"}B= $CPAN::Config->{"proxy_user"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | && $CPAN::Config->{proxy_user} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $PROXY_USER = $CPAN::Config->{proxy_user}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | $PROXY_PASSWORD = $CPAN::Config->{proxy_pass} || ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$CPAN::Config->{'proxy_pass'} || ''
$CPAN::Config->{'proxy_pass'} || ''
MC/DC0%0/1
$CPAN::Config->{'proxy_pass'} || ''
$CPAN::Config->{'proxy_pass'}
MC/DC0%0/1
$CPAN::Config->{'proxy_pass'} || ''
$CPAN::Config->{'proxy_pass'}
Truth table50%1/2
A
A= $CPAN::Config->{'proxy_pass'}
Truth table0%0/2
A
A= $CPAN::Config->{'proxy_pass'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | return ($PROXY_USER, $PROXY_PASSWORD); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | my $username_prompt = "\nProxy authentication needed! | |||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | (Note: to permanently configure username and password run | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | o conf proxy_user your_username | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | o conf proxy_pass your_password | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | )\nUsername:"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ($PROXY_USER, $PROXY_PASSWORD) = | |||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | _get_username_and_password_from_user($username_prompt); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | return ($PROXY_USER,$PROXY_PASSWORD); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | ▶ | sub get_non_proxy_credentials { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_non_proxy_credentials: called CC=5 SCAR=27.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_non_proxy_credentials: not called CC=5 SCAR=27.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if ($USER && $PASSWORD) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition16%1/6
$CPAN::HTTP::Credentials::USER and $CPAN::HTTP::Credentials::PASSWORD
$CPAN::HTTP::Credentials::USER and $CPAN::HTTP::Credentials::PASSWORD
MC/DC0%0/2
$CPAN::HTTP::Credentials::USER and $CPAN::HTTP::Credentials::PASSWORD
$CPAN::HTTP::Credentials::USER
$CPAN::HTTP::Credentials::PASSWORD
MC/DC0%0/2
$CPAN::HTTP::Credentials::USER and $CPAN::HTTP::Credentials::PASSWORD
$CPAN::HTTP::Credentials::USER
$CPAN::HTTP::Credentials::PASSWORD
Truth table33%1/3
A and B
A= $CPAN::HTTP::Credentials::USERB= $CPAN::HTTP::Credentials::PASSWORD
Truth table0%0/3
A and B
A= $CPAN::HTTP::Credentials::USERB= $CPAN::HTTP::Credentials::PASSWORD
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | return ($USER, $PASSWORD); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | if ( defined $CPAN::Config->{username} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | $USER = $CPAN::Config->{username}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | $PASSWORD = $CPAN::Config->{password} || ""; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition25%1/4
$CPAN::Config->{'password'} || ''
$CPAN::Config->{'password'} || ''
MC/DC0%0/1
$CPAN::Config->{'password'} || ''
$CPAN::Config->{'password'}
MC/DC0%0/1
$CPAN::Config->{'password'} || ''
$CPAN::Config->{'password'}
Truth table50%1/2
A
A= $CPAN::Config->{'password'}
Truth table0%0/2
A
A= $CPAN::Config->{'password'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | return ($USER, $PASSWORD); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | my $username_prompt = "\nAuthentication needed! | |||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | (Note: to permanently configure username and password run | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | o conf username your_username | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | o conf password your_password | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | )\nUsername:"; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ($USER, $PASSWORD) = | |||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | _get_username_and_password_from_user($username_prompt); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | return ($USER,$PASSWORD); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | sub _get_username_and_password_from_user { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_username_and_password_from_user: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | my $username_message = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_get_username_and_password_from_user: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | my ($username,$password); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ExtUtils::MakeMaker->import(qw(prompt)); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $username = prompt($username_message); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | if ($CPAN::META->has_inst("Term::ReadKey")) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | Term::ReadKey::ReadMode("noecho"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | $CPAN::Frontend->mywarn( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | "Warning: Term::ReadKey seems not to be available, your password will be echoed to the terminal!\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $password = prompt("Password:"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | if ($CPAN::META->has_inst("Term::ReadKey")) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | Term::ReadKey::ReadMode("restore"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | $CPAN::Frontend->myprint("\n\n"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | return ($username,$password); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 26 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||||||||