line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URI::Find::Simple; |
2
|
1
|
|
|
1
|
|
604
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
30
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
775
|
use URI::Find; |
|
1
|
|
|
|
|
8847
|
|
|
1
|
|
|
|
|
72
|
|
7
|
1
|
|
|
1
|
|
8
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
47
|
|
8
|
1
|
|
|
1
|
|
1112
|
use Encode qw( encode ); |
|
1
|
|
|
|
|
10689
|
|
|
1
|
|
|
|
|
567
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @ISA = qw( Exporter ); |
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw( list_uris change_uris ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = 1.06; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $CHARSET = "utf-8"; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub list_uris { |
19
|
3
|
|
|
3
|
1
|
941
|
my $text = shift; |
20
|
3
|
100
|
|
|
|
188
|
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
|
|
40460
|
my ($object, $text) = @_; |
25
|
5
|
|
|
|
|
26
|
push @list, $object->as_string; |
26
|
5
|
|
|
|
|
27
|
return $text; |
27
|
2
|
|
|
|
|
17
|
} ); |
28
|
|
|
|
|
|
|
|
29
|
2
|
50
|
|
|
|
32
|
if ($CHARSET) { |
30
|
2
|
|
|
|
|
8
|
my $copy = encode($CHARSET, $text); |
31
|
2
|
|
|
|
|
209
|
$copy =~ s/([^\000-\177])/'%' . sprintf("%x", ord($1))/eg; |
|
2
|
|
|
|
|
11
|
|
32
|
2
|
|
|
|
|
4
|
$text = $copy; |
33
|
|
|
|
|
|
|
} |
34
|
2
|
|
|
|
|
7
|
$uri_find->find(\$text); |
35
|
2
|
|
|
|
|
108
|
return @list; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub change_uris { |
39
|
3
|
|
|
3
|
1
|
526
|
my $text = shift; |
40
|
3
|
|
|
|
|
4
|
my $sub = shift; |
41
|
3
|
100
|
|
|
|
121
|
croak "expected a text string" unless defined($text); |
42
|
2
|
100
|
|
|
|
141
|
croak "expected a code ref" unless ref($sub) eq 'CODE'; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
my $uri_find = URI::Find->new( sub { |
45
|
4
|
|
|
4
|
|
767
|
my ($object, $text) = @_; |
46
|
4
|
|
|
|
|
10
|
return $sub->($object->as_string); |
47
|
1
|
|
|
|
|
10
|
} ); |
48
|
1
|
|
|
|
|
15
|
$uri_find->find(\$text); |
49
|
1
|
|
|
|
|
39
|
return $text; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |