line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URI::_userpass; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
3302
|
use strict; |
|
8
|
|
|
|
|
35
|
|
|
8
|
|
|
|
|
245
|
|
4
|
8
|
|
|
8
|
|
41
|
use warnings; |
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
276
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
43
|
use URI::Escape qw(uri_unescape); |
|
8
|
|
|
|
|
13
|
|
|
8
|
|
|
|
|
3735
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '5.19'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub user |
11
|
|
|
|
|
|
|
{ |
12
|
30
|
|
|
30
|
0
|
63
|
my $self = shift; |
13
|
30
|
|
|
|
|
74
|
my $info = $self->userinfo; |
14
|
30
|
100
|
|
|
|
68
|
if (@_) { |
15
|
8
|
|
|
|
|
16
|
my $new = shift; |
16
|
8
|
100
|
|
|
|
20
|
my $pass = defined($info) ? $info : ""; |
17
|
8
|
|
|
|
|
28
|
$pass =~ s/^[^:]*//; |
18
|
|
|
|
|
|
|
|
19
|
8
|
50
|
66
|
|
|
41
|
if (!defined($new) && !length($pass)) { |
20
|
0
|
|
|
|
|
0
|
$self->userinfo(undef); |
21
|
|
|
|
|
|
|
} else { |
22
|
8
|
100
|
|
|
|
20
|
$new = "" unless defined($new); |
23
|
8
|
|
|
|
|
16
|
$new =~ s/%/%25/g; |
24
|
8
|
|
|
|
|
9
|
$new =~ s/:/%3A/g; |
25
|
8
|
|
|
|
|
26
|
$self->userinfo("$new$pass"); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
} |
28
|
30
|
100
|
|
|
|
77
|
return undef unless defined $info; |
29
|
22
|
|
|
|
|
70
|
$info =~ s/:.*//; |
30
|
22
|
|
|
|
|
74
|
uri_unescape($info); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub password |
34
|
|
|
|
|
|
|
{ |
35
|
18
|
|
|
18
|
0
|
26
|
my $self = shift; |
36
|
18
|
|
|
|
|
44
|
my $info = $self->userinfo; |
37
|
18
|
100
|
|
|
|
78
|
if (@_) { |
38
|
8
|
|
|
|
|
15
|
my $new = shift; |
39
|
8
|
50
|
|
|
|
20
|
my $user = defined($info) ? $info : ""; |
40
|
8
|
|
|
|
|
73
|
$user =~ s/:.*//; |
41
|
|
|
|
|
|
|
|
42
|
8
|
100
|
|
|
|
23
|
if (!defined($new)) { |
43
|
3
|
100
|
|
|
|
30
|
$self->userinfo(length $user ? $user : undef); |
44
|
|
|
|
|
|
|
} else { |
45
|
5
|
50
|
|
|
|
11
|
$new = "" unless defined($new); |
46
|
5
|
|
|
|
|
9
|
$new =~ s/%/%25/g; |
47
|
5
|
|
|
|
|
18
|
$self->userinfo("$user:$new"); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
18
|
100
|
|
|
|
42
|
return undef unless defined $info; |
51
|
15
|
100
|
|
|
|
73
|
return undef unless $info =~ s/^[^:]*://; |
52
|
12
|
|
|
|
|
37
|
uri_unescape($info); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
1; |