line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Webqq::Util; |
2
|
1
|
|
|
1
|
|
5
|
use Exporter 'import'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
58
|
|
3
|
|
|
|
|
|
|
our @EXPORT_OK = qw(gen_url gen_url2) ; |
4
|
1
|
|
|
1
|
|
573
|
use URI::Escape qw(uri_escape); |
|
1
|
|
|
|
|
1608
|
|
|
1
|
|
|
|
|
276
|
|
5
|
|
|
|
|
|
|
sub gen_url{ |
6
|
0
|
|
|
0
|
0
|
|
my ($url,@query_string) = @_; |
7
|
0
|
|
|
|
|
|
my @query_string_pairs; |
8
|
0
|
|
|
|
|
|
push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string); |
9
|
0
|
|
|
|
|
|
return $url . '?' . join("&",@query_string_pairs); |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
sub gen_url2 { |
12
|
0
|
|
|
0
|
0
|
|
my ($url,@query_string) = @_; |
13
|
0
|
|
|
|
|
|
my @query_string_pairs; |
14
|
0
|
|
|
|
|
|
push @query_string_pairs , shift(@query_string) . "=" . uri_escape(shift(@query_string)) while(@query_string); |
15
|
0
|
|
|
|
|
|
return $url . '?' . join("&",@query_string_pairs); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
sub each { |
18
|
0
|
|
|
0
|
0
|
|
my $callback = pop; |
19
|
0
|
|
|
|
|
|
my @data; |
20
|
0
|
0
|
0
|
|
|
|
if(@_ == 1 and reftype $_[0] eq 'ARRAY'){ |
21
|
0
|
|
|
|
|
|
@data = @$_[0]; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
else{ |
24
|
0
|
|
|
|
|
|
@data = @_; |
25
|
|
|
|
|
|
|
} |
26
|
0
|
|
|
|
|
|
for (@data){ |
27
|
0
|
|
|
|
|
|
$callback->($_); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
1; |