line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URL::Builder; |
2
|
3
|
|
|
3
|
|
51721
|
use 5.008005; |
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
109
|
|
3
|
3
|
|
|
3
|
|
16
|
use strict; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
97
|
|
4
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
151
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.06"; |
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
2337
|
use parent qw(Exporter); |
|
3
|
|
|
|
|
891
|
|
|
3
|
|
|
|
|
15
|
|
9
|
|
|
|
|
|
|
|
10
|
3
|
|
|
3
|
|
2715
|
use WWW::Form::UrlEncoded qw(build_urlencoded_utf8 build_urlencoded); |
|
3
|
|
|
|
|
15185
|
|
|
3
|
|
|
|
|
855
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(build_url build_url_utf8); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub build_url { |
15
|
9
|
|
|
9
|
1
|
8787
|
my %args = @_; |
16
|
|
|
|
|
|
|
|
17
|
9
|
|
|
|
|
18
|
my $uri; |
18
|
9
|
100
|
|
|
|
34
|
if (exists $args{base_uri}) { |
19
|
4
|
|
|
|
|
24
|
$args{base_uri} =~ s!\/\z!!; |
20
|
4
|
|
|
|
|
9
|
$uri = $args{base_uri}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
9
|
|
|
|
|
21
|
$uri .= $args{path}; |
24
|
|
|
|
|
|
|
|
25
|
9
|
100
|
|
|
|
139
|
if ( defined $args{query} ) { |
26
|
7
|
|
|
|
|
32
|
$uri .= '?' . build_urlencoded($args{query}); |
27
|
|
|
|
|
|
|
} |
28
|
9
|
|
|
|
|
966
|
return $uri; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub build_url_utf8 { |
32
|
9
|
|
|
9
|
1
|
4256
|
my %args = @_; |
33
|
|
|
|
|
|
|
|
34
|
9
|
|
|
|
|
12
|
my $uri; |
35
|
9
|
100
|
|
|
|
23
|
if (exists $args{base_uri}) { |
36
|
4
|
|
|
|
|
10
|
$args{base_uri} =~ s!\/\z!!; |
37
|
4
|
|
|
|
|
7
|
$uri = $args{base_uri}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
9
|
|
|
|
|
18
|
$uri .= $args{path}; |
41
|
|
|
|
|
|
|
|
42
|
9
|
100
|
|
|
|
22
|
if ( defined $args{query} ) { |
43
|
7
|
|
|
|
|
24
|
$uri .= '?' . build_urlencoded_utf8($args{query}); |
44
|
|
|
|
|
|
|
} |
45
|
9
|
|
|
|
|
450
|
return $uri; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
__END__ |