line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Entities::Recursive; |
2
|
2
|
|
|
2
|
|
22264
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
74
|
|
3
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
95
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
2002
|
use Sub::Recursive; |
|
2
|
|
|
|
|
2386
|
|
|
2
|
|
|
|
|
246
|
|
7
|
2
|
|
|
2
|
|
1097
|
use HTML::Entities (); |
|
2
|
|
|
|
|
6998
|
|
|
2
|
|
|
|
|
930
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $fac = recursive { |
10
|
|
|
|
|
|
|
my $this = shift; |
11
|
|
|
|
|
|
|
my $how = pop; |
12
|
|
|
|
|
|
|
my @rest = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# See also http://www.stonehenge.com/merlyn/UnixReview/col30.html |
15
|
|
|
|
|
|
|
if (not ref $this) { |
16
|
|
|
|
|
|
|
HTML::Entities::Recursive->_do($this, @rest, $how); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
} elsif (ref $this eq "ARRAY") { |
19
|
|
|
|
|
|
|
[map $REC->($_, @rest, $how), @$this]; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} elsif (ref $this eq "HASH") { |
22
|
|
|
|
|
|
|
+{map { $_ => $REC->($this->{$_}, @rest, $how) } keys %$this}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
} elsif (ref $this eq 'SCALAR') { |
25
|
|
|
|
|
|
|
\($REC->($$this, @rest, $how)); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} else { |
28
|
|
|
|
|
|
|
($this, @rest); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub new { |
33
|
1
|
|
|
1
|
1
|
14
|
my $class = shift; |
34
|
1
|
|
|
|
|
4
|
return bless {}, $class; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _do { |
38
|
45
|
|
|
45
|
|
49
|
my $self = shift; |
39
|
45
|
|
|
|
|
48
|
my $text = shift; |
40
|
45
|
|
|
|
|
45
|
my $how = pop; |
41
|
|
|
|
|
|
|
|
42
|
45
|
100
|
|
|
|
103
|
if ($how eq 'decode') { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
43
|
9
|
50
|
|
|
|
112
|
defined $text ? (HTML::Entities::decode($text, @_)) : ($text, @_); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} elsif ($how eq 'encode') { |
46
|
18
|
50
|
|
|
|
59
|
defined $text ? (HTML::Entities::encode($text, @_)) : ($text, @_); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} elsif ($how eq 'encode_numeric') { |
49
|
18
|
50
|
|
|
|
62
|
defined $text ? (HTML::Entities::encode_numeric($text, @_)) : ($text, @_); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} else { |
52
|
0
|
|
|
|
|
0
|
Carp::croak("$how is unknown function"); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub decode { |
57
|
1
|
|
|
1
|
1
|
436
|
shift; $fac->(@_, 'decode'); |
|
1
|
|
|
|
|
4
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub encode { |
61
|
2
|
|
|
2
|
1
|
416
|
shift; $fac->(@_, 'encode'); |
|
2
|
|
|
|
|
13
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub encode_numeric { |
65
|
2
|
|
|
2
|
1
|
901
|
shift; $fac->(@_, 'encode_numeric'); |
|
2
|
|
|
|
|
11
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
69
|
|
|
|
|
|
|
__END__ |