line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URI::Find::Simple; |
2
|
1
|
|
|
1
|
|
829
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
63
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
36
|
use 5.006; |
|
1
|
|
|
|
|
5
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
605
|
use URI::Find; |
|
1
|
|
|
|
|
8616
|
|
|
1
|
|
|
|
|
81
|
|
7
|
1
|
|
|
1
|
|
10
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
8
|
1
|
|
|
1
|
|
762
|
use Encode qw( encode ); |
|
1
|
|
|
|
|
11664
|
|
|
1
|
|
|
|
|
418
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw( Exporter ); |
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw( list_uris change_uris ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = 1.07; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $CHARSET = "utf-8"; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub list_uris { |
19
|
3
|
|
|
3
|
1
|
1212
|
my $text = shift; |
20
|
3
|
100
|
|
|
|
204
|
croak "expected a text string" unless defined($text); |
21
|
|
|
|
|
|
|
|
22
|
2
|
|
|
|
|
3
|
my @list; |
23
|
|
|
|
|
|
|
my $uri_find = URI::Find->new( sub { |
24
|
5
|
|
|
5
|
|
37268
|
my ($object, $text) = @_; |
25
|
5
|
|
|
|
|
28
|
push @list, $object->as_string; |
26
|
5
|
|
|
|
|
33
|
return $text; |
27
|
2
|
|
|
|
|
25
|
} ); |
28
|
|
|
|
|
|
|
|
29
|
2
|
50
|
|
|
|
38
|
if ($CHARSET) { |
30
|
2
|
|
|
|
|
12
|
my $copy = encode($CHARSET, $text); |
31
|
2
|
|
|
|
|
324
|
$copy =~ s/([^\000-\177])/'%' . sprintf("%x", ord($1))/eg; |
|
2
|
|
|
|
|
15
|
|
32
|
2
|
|
|
|
|
4
|
$text = $copy; |
33
|
|
|
|
|
|
|
} |
34
|
2
|
|
|
|
|
12
|
$uri_find->find(\$text); |
35
|
2
|
|
|
|
|
123
|
return @list; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub change_uris { |
39
|
3
|
|
|
3
|
1
|
612
|
my $text = shift; |
40
|
3
|
|
|
|
|
6
|
my $sub = shift; |
41
|
3
|
100
|
|
|
|
95
|
croak "expected a text string" unless defined($text); |
42
|
2
|
100
|
|
|
|
147
|
croak "expected a code ref" unless ref($sub) eq 'CODE'; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $uri_find = URI::Find->new( sub { |
45
|
4
|
|
|
4
|
|
1006
|
my ($object, $text) = @_; |
46
|
4
|
|
|
|
|
13
|
return $sub->($object->as_string); |
47
|
1
|
|
|
|
|
21
|
} ); |
48
|
1
|
|
|
|
|
20
|
$uri_find->find(\$text); |
49
|
1
|
|
|
|
|
45
|
return $text; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |