XMLWriter/PCData.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 33 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
_get
2.0
BEGIN
2.0
CRAP 2.0
1 =head1 NAME
2  
3 XML::XMLWriter::PCData - XML::XMLWriter parsed character data class
4  
5 =cut
6  
7 ######################################################################
8  
9 package XML::XMLWriter::PCData;
10 require 5.8.0;
11  
12 ######################################################################
13  
14 use strict;
15  
16 ######################################################################
17  
18 =head2 Methods
19  
20 =head3 new (@text)
21  
22 @text must be an array of strings.
23  
24 Every element of @text is parsed and saved. Parsing sofar only means
25 that &, < and > are replaced by their XML entities (&amp;, &lt; and
26 &gt;).
27  
28 =cut
29  
30 ######################################################################
31  
32 sub new {
33 my($class, @text) = @_;
34 my $self = bless({}, ref($class) || $class);
35 for(my $i=0; $i<@text; $i++) {
36 $text[$i] =~ s/&/&amp;/g;
37 $text[$i] =~ s/</&lt;/g;
38 $text[$i] =~ s/>/&gt;/g;
39 }
40 $self->{data} = \@text;
41 return $self;
42 }
43  
44 ######################################################################
45  
46 =head3 get ()
47  
48 Returns the strings of parsed character data in an array.
49  
50 =cut
51  
52 ######################################################################
53  
54 sub _get {
55 my($self) = @_;
56 return @{$self->{data}};
57 }
58  
59 ######################################################################
60  
61 return 1;
62  
63 __END__