dhtml_test.pl untested

filter: Statementstmt 0.0% 0 / 35 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 39 CC 1 SCAR 6.9
CC
1
Cov
0%
GetData
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1  
2 use strict ;
3 use Data::TreeDumper ;
4  
5 #-------------------------------------------------------------------------------
6  
7 # the renderer can return a default style. This is needed as styles must be at the top of the document
8 my $style ;
9 my $body = DumpTree
10 (
11 GetData(), 'Data'
12 , DISPLAY_ADDRESS => 0
13 , DISPLAY_ROOT_ADDRESS => 1
14 #~ , DISPLAY_PERL_ADDRESS => 1
15 #~ , DISPLAY_PERL_SIZE => 1
16 , RENDERER =>
17 {
18 NAME => 'DHTML'
19 , STYLE => \$style
20 , BUTTON =>
21 {
22 COLLAPSE_EXPAND => 1
23 , SEARCH => 1
24 }
25 }
26 ) ;
27
28 my $body2 = '' ;
29 my $style2 = '' ;
30 my $body2 = DumpTree
31 (
32 GetData(), 'Data2'
33 , DISPLAY_ROOT_ADDRESS => 1
34 #~ , DISPLAY_PERL_ADDRESS => 1
35 #~ , DISPLAY_PERL_SIZE => 1
36 , RENDERER =>
37 {
38 NAME => 'DHTML'
39 , STYLE => \$style2
40 , COLLAPSED => 1
41 , CLASS => 'collapse_test'
42 , BUTTON =>
43 {
44 COLLAPSE_EXPAND => 1
45 , SEARCH => 1
46 }
47 }
48 ) ;
49
50  
51 print <<EOT;
52 <?xml version="1.0" encoding="iso-8859-1"?>
53 <!DOCTYPE html
54 PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
55 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
56 >
57
58 <html>
59 <!-- Automatically generated by Perl and Data::TreeDumper::Renderer::DHTML-->
60 <head>
61 <title>Data</title>
62 $style
63 $style2
64 </head>
65 <body>
66  
67 $body
68 $body2
69  
70 </body>
71 </html>
72 EOT
73  
74 #-------------------------------------------------------------------------------
75  
76 sub GetData
77 {
78 my $s = {
79 'REGEX' => q#(<|>|&|\'|\" &nbsp;)#,
80 'STDIN' => \*STDIN,
81 'RS' => \4,
82
83 'A' => {
84 'a' => {},
85 'code1' => sub { "DUMMY" },
86 'b' => {
87 'a' => 0,
88 'b' => 1,
89 'c' => {
90 'a' => 1,
91 'b' => 1,
92 'c' => 1,
93 }
94 },
95 'b2' => {
96 'a' => 1,
97 'b' => 1,
98 'c' => 1,
99 }
100 },
101 'C' => {
102 'b' => {
103 'a' => {
104 'c' => 42,
105 'a' => 3,
106 'b' => sub { "DUMMY" },
107 'empty' => undef
108 }
109 }
110 },
111 'ARRAY' => [
112 'elment_1',
113 'element_2',
114 'element_3',
115 [1, 2],
116 {a => 1, b => 2}
117 ]
118 };
119  
120 ${$s->{'A'}{'code3'}} = $s->{'A'}{'code1'};
121 $s->{'A'}{'code2'} = $s->{'A'}{'code1'};
122 $s->{'CopyOfARRAY'} = $s->{'ARRAY'};
123 $s->{'C1'} = \($s->{'C2'});
124 $s->{'C2'} = \($s->{'C1'});
125  
126 $s->{za} = $s->{A} ;
127  
128 my $object = bless {A =>[], B => 123}, 'SuperObject' ;
129 $s->{object} = $object ;
130  
131 return($s) ;
132 }
133  
134