line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URI::Split; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
70586
|
use strict; |
|
1
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '5.19'; |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Exporter 5.57 'import'; |
|
1
|
|
|
|
|
21
|
|
|
1
|
|
|
|
|
62
|
|
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw(uri_split uri_join); |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
465
|
use URI::Escape (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
793
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub uri_split { |
14
|
5
|
|
|
5
|
1
|
3414
|
return $_[0] =~ m,(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?,; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub uri_join { |
18
|
12
|
|
|
12
|
1
|
667
|
my($scheme, $auth, $path, $query, $frag) = @_; |
19
|
12
|
100
|
|
|
|
32
|
my $uri = defined($scheme) ? "$scheme:" : ""; |
20
|
12
|
100
|
|
|
|
31
|
$path = "" unless defined $path; |
21
|
12
|
100
|
|
|
|
37
|
if (defined $auth) { |
|
|
100
|
|
|
|
|
|
22
|
5
|
|
|
|
|
21
|
$auth =~ s,([/?\#]), URI::Escape::escape_char($1),eg; |
|
4
|
|
|
|
|
10
|
|
23
|
5
|
|
|
|
|
9
|
$uri .= "//$auth"; |
24
|
5
|
100
|
100
|
|
|
26
|
$path = "/$path" if length($path) && $path !~ m,^/,; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
elsif ($path =~ m,^//,) { |
27
|
1
|
|
|
|
|
2
|
$uri .= "//"; # XXX force empty auth |
28
|
|
|
|
|
|
|
} |
29
|
12
|
100
|
|
|
|
28
|
unless (length $uri) { |
30
|
4
|
|
|
|
|
25
|
$path =~ s,(:), URI::Escape::escape_char($1),e while $path =~ m,^[^:/?\#]+:,; |
|
1
|
|
|
|
|
7
|
|
31
|
|
|
|
|
|
|
} |
32
|
12
|
|
|
|
|
30
|
$path =~ s,([?\#]), URI::Escape::escape_char($1),eg; |
|
2
|
|
|
|
|
6
|
|
33
|
12
|
|
|
|
|
18
|
$uri .= $path; |
34
|
12
|
100
|
|
|
|
24
|
if (defined $query) { |
35
|
3
|
|
|
|
|
8
|
$query =~ s,(\#), URI::Escape::escape_char($1),eg; |
|
1
|
|
|
|
|
2
|
|
36
|
3
|
|
|
|
|
6
|
$uri .= "?$query"; |
37
|
|
|
|
|
|
|
} |
38
|
12
|
100
|
|
|
|
21
|
$uri .= "#$frag" if defined $frag; |
39
|
12
|
|
|
|
|
67
|
$uri; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |