File Coverage

blib/lib/Lingua/YaTeA/XMLEntities.pm
Criterion Covered Total %
statement 12 18 66.6
branch n/a
condition n/a
subroutine 3 4 75.0
pod 2 2 100.0
total 17 24 70.8


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             package Lingua::YaTeA::XMLEntities;
4 5     5   30 use strict;
  5         8  
  5         116  
5 5     5   36 use warnings;
  5         9  
  5         1103  
6              
7             our $VERSION=$Lingua::YaTeA::VERSION;
8              
9             sub encode
10             {
11 736     736 1 997 $_[0]=~s/&/&/go;
12 736         862 $_[0]=~s/\"/"/go;
13 736         831 $_[0]=~s/\'/'/go;
14 736         839 $_[0]=~s/
15 736         875 $_[0]=~s/>/>/go;
16              
17 736         895 return($_[0]);
18             }
19              
20              
21             =head2 decode($line)
22              
23             This method decodes XML entities corresponding to special XML characters in the line C<$line> .
24              
25             =cut
26              
27              
28             sub decode
29             {
30 0     0 1   $_[0]=~s/"/\"/go;
31 0           $_[0]=~s/'/\'/go;
32 0           $_[0]=~s/&/&/go;
33 0           $_[0]=~s/</
34 0           $_[0]=~s/>/>/go;
35              
36 0           return($_[0]);
37             }
38              
39             1;
40              
41             __END__