CPL/Layout.pm

filter: Statementstmt 93.8% 91 / 97 Branchbran 57.1% 24 / 42 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 96.1% 25 / 26 Podpod 100% 21 / 21 totaltotal 86.5% 161 / 186 CC 26 SCAR 8.5
CC
26
Cov
83%
new
5.0
xmlo
3.0
fromxml
3.0
CRAP 2.3
« CPL/Story.pm ↑ Summary CPL/DirectoryList.pm »
1 package Video::CPL::Layout;
2  
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use XML::Writer;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 Video::CPL::Layout - Manage layouts.
12  
13 =head1 VERSION
14  
15 Version 0.10
16  
17 =cut
18  
19 1 our $VERSION = '0.10';
20  
21  
22 =head1 SYNOPSIS
23  
24 Create or manage CPL layouts.
25  
26 =head1 SUBROUTINES/METHODS
27  
28 =cut
29  
30 1 our @FIELDS = qw(videoHeight videoVCenter videoTop videoBottom videoWidth videoHCenter videoLeft videoRight webHeight webVCenter webTop webBottom webWidth webHCenter webLeft webRight name);
31  
32 =head2 videoHeight([$val])
33  
34 Accessor method to get or set videoHeight.
35  
36 =cut
37  
38 2 ▶sub videoHeight { my $obj = shift; $obj->{videoHeight} = shift if @_; return $obj->{videoHeight};};
Subroutine videoHeight: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
39  
40 =head2 videoVCenter([$val])
41  
42 Accessor method to get or set videoVCenter.
43  
44 =cut
45  
46 2 ▶sub videoVCenter { my $obj = shift; $obj->{videoVCenter} = shift if @_; return $obj->{videoVCenter};};
Subroutine videoVCenter: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
47  
48 =head2 videoTop([$val])
49  
50 Accessor method to get or set videoTop.
51  
52 =cut
53  
54 2 ▶sub videoTop { my $obj = shift; $obj->{videoTop} = shift if @_; return $obj->{videoTop};};
Subroutine videoTop: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
55  
56 =head2 videoBottom([$val])
57  
58 Accessor method to get or set videoBottom.
59  
60 =cut
61  
62 2 ▶sub videoBottom { my $obj = shift; $obj->{videoBottom} = shift if @_; return $obj->{videoBottom};};
Subroutine videoBottom: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
63  
64 =head2 videoWidth([$val])
65  
66 Accessor method to get or set videoWidth.
67  
68 =cut
69  
70 2 ▶sub videoWidth { my $obj = shift; $obj->{videoWidth} = shift if @_; return $obj->{videoWidth};};
Subroutine videoWidth: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
71  
72 =head2 videoHCenter([$val])
73  
74 Accessor method to get or set videoHCenter.
75  
76 =cut
77  
78 2 ▶sub videoHCenter { my $obj = shift; $obj->{videoHCenter} = shift if @_; return $obj->{videoHCenter};};
Subroutine videoHCenter: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
79  
80 =head2 videoLeft([$val])
81  
82 Accessor method to get or set videoLeft.
83  
84 =cut
85  
86 2 ▶sub videoLeft { my $obj = shift; $obj->{videoLeft} = shift if @_; return $obj->{videoLeft};};
Subroutine videoLeft: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
87  
88 =head2 videoRight([$val])
89  
90 Accessor method to get or set videoRight.
91  
92 =cut
93  
94 2 ▶sub videoRight { my $obj = shift; $obj->{videoRight} = shift if @_; return $obj->{videoRight};};
Subroutine videoRight: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
95  
96 =head2 webHeight([$val])
97  
98 Accessor method to get or set webHeight.
99  
100 =cut
101  
102 2 ▶sub webHeight { my $obj = shift; $obj->{webHeight} = shift if @_; return $obj->{webHeight};};
Subroutine webHeight: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
103  
104 =head2 webVCenter([$val])
105  
106 Accessor method to get or set webVCenter.
107  
108 =cut
109  
110 2 ▶sub webVCenter { my $obj = shift; $obj->{webVCenter} = shift if @_; return $obj->{webVCenter};};
Subroutine webVCenter: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
111  
112 =head2 webTop([$val])
113  
114 Accessor method to get or set webTop.
115  
116 =cut
117  
118 2 ▶sub webTop { my $obj = shift; $obj->{webTop} = shift if @_; return $obj->{webTop};};
Subroutine webTop: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
119  
120 =head2 webBottom([$val])
121  
122 Accessor method to get or set webBottom.
123  
124 =cut
125  
126 2 ▶sub webBottom { my $obj = shift; $obj->{webBottom} = shift if @_; return $obj->{webBottom};};
Subroutine webBottom: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
127  
128 =head2 webWidth([$val])
129  
130 Accessor method to get or set webWidth.
131  
132 =cut
133  
134 2 ▶sub webWidth { my $obj = shift; $obj->{webWidth} = shift if @_; return $obj->{webWidth};};
Subroutine webWidth: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
135  
136 =head2 webHCenter([$val])
137  
138 Accessor method to get or set webHCenter.
139  
140 =cut
141  
142 2 ▶sub webHCenter { my $obj = shift; $obj->{webHCenter} = shift if @_; return $obj->{webHCenter};};
Subroutine webHCenter: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
143  
144 =head2 webLeft([$val])
145  
146 Accessor method to get or set webLeft.
147  
148 =cut
149  
150 2 ▶sub webLeft { my $obj = shift; $obj->{webLeft} = shift if @_; return $obj->{webLeft};};
Subroutine webLeft: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
151  
152 =head2 webRight([$val])
153  
154 Accessor method to get or set webRight.
155  
156 =cut
157  
158 2 ▶sub webRight { my $obj = shift; $obj->{webRight} = shift if @_; return $obj->{webRight};};
Subroutine webRight: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 2 2
159  
160 =head2 name([$val])
161  
162 Accessor method to get or set name.
163  
164 =cut
165  
166 64 ▶sub name { my $obj = shift; $obj->{name} = shift if @_; return $obj->{name};};
Subroutine name: called CC=2 SCAR=7.1
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 64 64
167  
168 =head2 new([videoHeight=>$val,videoVCenter=>$val,videoTop=>$val,videoBottom=>$val,videoWidth=>$val,
169 videoHCenter=>$val,videoLeft=>$val,videoRight=>$val,webHeight=>$val,webVCenter=>$val,
170 webTop=>$val,webBottom=>$val,webWidth=>$val,webHCenter=>$val,webLeft=>$val,webRight=>$val,
171 name=>$val])
172  
173 Create a new Layout object. A name must be specified and will not be auto-generated. Other objects
174 which refer to this Layout should use the name and not the object.
175  
176 =cut
177  
178 4 ▶sub new {
Subroutine new: called CC=5 SCAR=16.1
Pod documented
179 4 my $pkg = shift;
180 4 my %parms = @_;
181 4 my $ret = {};
182 4 bless $ret,$pkg;
183  
184 4 foreach my $x (@FIELDS){
185 68 ▶ $ret->{$x} = $parms{$x} if defined $parms{$x};
Branch: 1 branch
BranchTrueFalseTotal
if defined $parms{$x} 36 32 68
186 }
187 4 foreach my $x (keys %parms){
188 36 ▶ confess("Parameter ('$x') given to Video::CPL::Layout::new, but not understood\n") if !defined $ret->{$x};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ret->{$x} 0 36 36
189 }
190  
191 4 return $ret;
192 }
193  
194 =head2 xmlo
195
196 Given an XML::Writer object, add the xml information for this Layout.
197  
198 =cut
199  
200 2 ▶sub xmlo {
Subroutine xmlo: called CC=3 SCAR=11.0
Pod documented
201 2 my $obj = shift;
202 2 my $xo = shift;
203 2 my %p;
204 2 foreach my $x (@FIELDS){
205 34 ▶ $p{$x} = $obj->{$x} if defined $obj->{$x};
Branch: 1 branch
BranchTrueFalseTotal
if defined $obj->{$x} 18 16 34
206 }
207 2 $xo->emptyTag("layout",%p);
208 }
209  
210 =head2 xml()
211  
212 Return the xml format of a Layout object.
213  
214 =cut
215  
216 0 ▶sub xml {
Subroutine xml: not called CC=1 SCAR=6.9
Pod documented
217 0 my $obj = shift;
218 0 my $a;
219 0 my $xo = new XML::Writer(OUTPUT=>\$a);
220 0 $obj->xmlo($xo);
221 0 $xo->end();
222 0 return $a;
223 }
224  
225 =head2 fromxml()
226  
227 =cut
228  
229 2 ▶sub fromxml {
Subroutine fromxml: called CC=3 SCAR=11.0
Pod documented
230 2 my $s = shift;
231 2 my %s = %{$s};
232 2 my %p;
233 2 foreach my $q (@FIELDS){
234 34 ▶ $p{$q} = $s{$q} if defined($s{$q});
Branch: 1 branch
BranchTrueFalseTotal
if defined $s{$q} 18 16 34
235 }
236 2 return new Video::CPL::Layout(%p);
237 }
238  
239 =head1 AUTHOR
240  
241 Carl Rosenberg, C<< <perl at coincident.tv> >>
242  
243 =head1 BUGS
244  
245 Please report any bugs or feature requests to Coincident TV.
246  
247 =head1 SUPPORT
248  
249 You can find documentation for this module with the perldoc command.
250  
251 perldoc Video::CPL::Layout
252  
253 =head1 LICENSE AND COPYRIGHT
254  
255 Copyright 2010 Coincident TV
256  
257 Licensed under the Apache License, Version 2.0 (the "License");
258 you may not use this file except in compliance with the License.
259 You may obtain a copy of the License at
260  
261 http://www.apache.org/licenses/LICENSE-2.0
262  
263 Unless required by applicable law or agreed to in writing, software
264 distributed under the License is distributed on an "AS IS" BASIS,
265 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
266 See the License for the specific language governing permissions and
267 limitations under the License.
268 =cut
269  
270 1 1; # End of Video::CPL::Layout
« CPL/Story.pm ↑ Summary CPL/DirectoryList.pm »