File Coverage

blib/lib/POE/XUL/CDATA.pm
Criterion Covered Total %
statement 37 41 90.2
branch 4 6 66.6
condition n/a
subroutine 13 16 81.2
pod 9 12 75.0
total 63 75 84.0


line stmt bran cond sub pod time code
1             package POE::XUL::CDATA;
2             # $Id: CDATA.pm 1566 2010-11-03 03:13:32Z fil $
3             # Copyright Philip Gwyn 2007-2010. All rights reserved.
4              
5 21     21   72 use strict;
  21         24  
  21         503  
6 21     21   65 use warnings;
  21         21  
  21         427  
7 21     21   69 use Carp;
  21         19  
  21         8330  
8              
9             our $VERSION = '0.0601';
10              
11              
12             ################################################################
13             sub new
14             {
15 2     2 0 5 my( $package, $data ) = @_;
16 2         7 my $self = bless { data=>'' }, $package;
17 2         9 $self->nodeValue( $data );
18 2         4 return $self;
19             }
20              
21             ################################################################
22 0     0 0 0 sub is_window { 0 }
23              
24             ################################################################
25             sub update_CM
26             {
27 7     7 0 6 my( $self ) = @_;
28 7 100       16 return unless $POE::XUL::Node::CM;
29 6         15 $POE::XUL::Node::CM->after_cdata_change( $self );
30             }
31              
32              
33             ################################################################
34             sub nodeValue
35             {
36 2     2 1 3 my( $self, $value ) = @_;
37            
38 2 50       7 if( 2==@_ ) {
39 2         9 $_[0]->{data} = $value;
40 2         8 $self->update_CM;
41             }
42 2         3 return $_[0]->{data};
43             }
44              
45             ################################################################
46             sub substringData
47             {
48 0     0 1 0 my( $self, $offset, $count ) = @_;
49 0         0 return substr( $self->{data}, $offset, $count );
50             }
51              
52             ################################################################
53             sub appendData
54             {
55 1     1 1 655 my( $self, $data ) = @_;
56 1         2 $self->{data} .= $data;
57 1         3 $self->update_CM;
58             }
59              
60             ################################################################
61             sub insertData
62             {
63 1     1 1 626 my( $self, $offset, $data ) = @_;
64 1         4 substr( $self->{data}, $offset, 0, $data );
65 1         3 $self->update_CM;
66             }
67              
68             ################################################################
69             sub deleteData
70             {
71 2     2 1 815 my( $self, $offset, $count ) = @_;
72 2         4 substr( $self->{data}, $offset, $count, '');
73 2         4 $self->update_CM;
74             }
75              
76             ################################################################
77             sub replaceData
78             {
79 1     1 1 6 my( $self, $offset, $count, $data ) = @_;
80 1         4 substr( $self->{data}, $offset, $count, $data );
81 1         2 $self->update_CM;
82             }
83              
84             ################################################################
85             sub as_xml
86             {
87 1     1 1 6 return qq({data}]]>);
88             }
89              
90             ################################################################
91             sub children
92             {
93 8     8 1 12 return;
94             }
95              
96             ################################################################
97             sub dispose
98             {
99 0     0 1 0 return;
100             }
101              
102             ################################################################
103             sub DESTROY
104             {
105 1     1   1 my( $self ) = @_;
106 1 50       8 $POE::XUL::Node::CM->after_destroy( $self )
107             if $POE::XUL::Node::CM;
108             }
109              
110             1;
111              
112             __DATA__