| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package URI::file::Base; |
|
2
|
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
2322
|
use strict; |
|
|
4
|
|
|
|
|
19
|
|
|
|
4
|
|
|
|
|
216
|
|
|
4
|
4
|
|
|
4
|
|
28
|
use warnings; |
|
|
4
|
|
|
|
|
10
|
|
|
|
4
|
|
|
|
|
161
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
41
|
use URI::Escape (); |
|
|
4
|
|
|
|
|
22
|
|
|
|
4
|
|
|
|
|
3039
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '5.21'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new |
|
11
|
|
|
|
|
|
|
{ |
|
12
|
51
|
|
|
51
|
0
|
122
|
my $class = shift; |
|
13
|
51
|
|
|
|
|
113
|
my $path = shift; |
|
14
|
51
|
100
|
|
|
|
112
|
$path = "" unless defined $path; |
|
15
|
|
|
|
|
|
|
|
|
16
|
51
|
|
|
|
|
84
|
my($auth, $escaped_auth, $escaped_path); |
|
17
|
|
|
|
|
|
|
|
|
18
|
51
|
|
|
|
|
229
|
($auth, $escaped_auth) = $class->_file_extract_authority($path); |
|
19
|
51
|
|
|
|
|
204
|
($path, $escaped_path) = $class->_file_extract_path($path); |
|
20
|
|
|
|
|
|
|
|
|
21
|
51
|
100
|
|
|
|
125
|
if (defined $auth) { |
|
22
|
12
|
50
|
|
|
|
33
|
$auth =~ s,%,%25,g unless $escaped_auth; |
|
23
|
12
|
|
|
|
|
30
|
$auth =~ s,([/?\#]), URI::Escape::escape_char($1),eg; |
|
|
0
|
|
|
|
|
0
|
|
|
24
|
12
|
|
|
|
|
21
|
$auth = "//$auth"; |
|
25
|
12
|
50
|
|
|
|
28
|
if (defined $path) { |
|
26
|
12
|
100
|
|
|
|
39
|
$path = "/$path" unless substr($path, 0, 1) eq "/"; |
|
27
|
|
|
|
|
|
|
} else { |
|
28
|
0
|
|
|
|
|
0
|
$path = ""; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
} else { |
|
31
|
39
|
50
|
|
|
|
148
|
return undef unless defined $path; |
|
32
|
39
|
|
|
|
|
95
|
$auth = ""; |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
51
|
100
|
|
|
|
242
|
$path =~ s,([%;?]), URI::Escape::escape_char($1),eg unless $escaped_path; |
|
|
0
|
|
|
|
|
0
|
|
|
36
|
51
|
|
|
|
|
107
|
$path =~ s/\#/%23/g; |
|
37
|
|
|
|
|
|
|
|
|
38
|
51
|
|
|
|
|
175
|
my $uri = $auth . $path; |
|
39
|
51
|
100
|
|
|
|
222
|
$uri = "file:$uri" if substr($uri, 0, 1) eq "/"; |
|
40
|
|
|
|
|
|
|
|
|
41
|
51
|
|
|
|
|
326
|
URI->new($uri, "file"); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _file_extract_authority |
|
45
|
|
|
|
|
|
|
{ |
|
46
|
44
|
|
|
44
|
|
188
|
my($class, $path) = @_; |
|
47
|
44
|
100
|
|
|
|
255
|
return undef unless $class->_file_is_absolute($path); |
|
48
|
18
|
|
|
|
|
99
|
return $URI::file::DEFAULT_AUTHORITY; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _file_extract_path |
|
52
|
|
|
|
|
|
|
{ |
|
53
|
0
|
|
|
0
|
|
0
|
return undef; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _file_is_absolute |
|
57
|
|
|
|
|
|
|
{ |
|
58
|
12
|
|
|
12
|
|
43
|
return 0; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _file_is_localhost |
|
62
|
|
|
|
|
|
|
{ |
|
63
|
10
|
|
|
10
|
|
14
|
shift; # class |
|
64
|
10
|
|
|
|
|
17
|
my $host = lc(shift); |
|
65
|
10
|
50
|
|
|
|
46
|
return 1 if $host eq "localhost"; |
|
66
|
10
|
|
|
|
|
15
|
eval { |
|
67
|
10
|
|
|
|
|
1059
|
require Net::Domain; |
|
68
|
10
|
50
|
50
|
|
|
18527
|
lc(Net::Domain::hostfqdn() || '') eq $host || |
|
|
|
|
50
|
|
|
|
|
|
69
|
|
|
|
|
|
|
lc(Net::Domain::hostname() || '') eq $host; |
|
70
|
|
|
|
|
|
|
}; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub file |
|
74
|
|
|
|
|
|
|
{ |
|
75
|
0
|
|
|
0
|
0
|
|
undef; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub dir |
|
79
|
|
|
|
|
|
|
{ |
|
80
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
81
|
0
|
|
|
|
|
|
$self->file(@_); |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |