line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Escape::PurePerl; |
2
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
3
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
16
|
|
4
|
1
|
|
|
1
|
|
3
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
die qq{Don't use HTML::Escape::PurePerl directly, use HTML::Escape instead.\n} # ' for poor editors |
7
|
|
|
|
|
|
|
if caller() ne 'HTML::Escape'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package # do not index, pause. |
10
|
|
|
|
|
|
|
HTML::Escape; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our %_escape_table = ( '&' => '&', '>' => '>', '<' => '<', q{"} => '"', q{'} => ''', q{`} => '`', '{' => '{', '}' => '}' ); |
13
|
|
|
|
|
|
|
sub escape_html { |
14
|
5
|
|
|
5
|
0
|
8
|
my $str = shift; |
15
|
5
|
50
|
|
|
|
9
|
return '' |
16
|
|
|
|
|
|
|
unless defined $str; |
17
|
5
|
|
|
|
|
24
|
$str =~ s/([&><"'`{}])/$_escape_table{$1}/ge; #' for poor editors |
|
7
|
|
|
|
|
18
|
|
18
|
5
|
|
|
|
|
15
|
return $str; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|