line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::Template::Compiled::Plugin::XMLEscape; |
2
|
1
|
|
|
1
|
|
956
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
20
|
|
4
|
1
|
|
|
1
|
|
3
|
use Carp qw(croak carp); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
5
|
1
|
|
|
1
|
|
3
|
use HTML::Template::Compiled; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
8
|
|
6
|
|
|
|
|
|
|
HTML::Template::Compiled->register(__PACKAGE__); |
7
|
|
|
|
|
|
|
our $VERSION = '1.003'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub register { |
10
|
1
|
|
|
1
|
1
|
1
|
my ($class) = @_; |
11
|
1
|
|
|
|
|
4
|
my %plugs = ( |
12
|
|
|
|
|
|
|
escape => { |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
XML => \&escape_xml, |
15
|
|
|
|
|
|
|
XML_ATTR => 'HTML::Template::Compiled::Plugin::XMLEscape::escape_xml_attr', |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
); |
18
|
1
|
|
|
|
|
2
|
return \%plugs; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub escape_xml { |
22
|
2
|
50
|
|
2
|
1
|
10
|
defined( my $escaped = $_[0] ) or return; |
23
|
2
|
|
|
|
|
3
|
$escaped =~ s/&/&/g; |
24
|
2
|
|
|
|
|
4
|
$escaped =~ s/</g; |
25
|
2
|
|
|
|
|
4
|
$escaped =~ s/>/>/g; |
26
|
2
|
|
|
|
|
2
|
$escaped =~ s/"/"/g; |
27
|
2
|
|
|
|
|
2
|
$escaped =~ s/'/'/g; |
28
|
2
|
|
|
|
|
22
|
return $escaped; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub escape_xml_attr { |
32
|
2
|
50
|
|
2
|
1
|
6
|
defined( my $escaped = $_[0] ) or return; |
33
|
2
|
|
|
|
|
3
|
$escaped =~ s/&/&/g; |
34
|
2
|
|
|
|
|
4
|
$escaped =~ s/</g; |
35
|
2
|
|
|
|
|
3
|
$escaped =~ s/>/>/g; |
36
|
2
|
|
|
|
|
2
|
$escaped =~ s/"/"/g; |
37
|
2
|
|
|
|
|
1
|
$escaped =~ s/'/'/g; |
38
|
2
|
|
|
|
|
22
|
return $escaped; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |