CPL/Target.pm

filter: Statementstmt 72.7% 40 / 55 Branchbran 50.0% 7 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 8 / 12 Podpod 100% 7 / 7 totaltotal 70.4% 62 / 88 CC 12 SCAR 13.2
CC
12
Cov
68%
cuePointRef
6.0
association
6.0
modal
6.0
CRAP 3.7
« CPL/TargetList.pm ↑ Summary CPL/Story.pm »
1 package Video::CPL::Target;
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 Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use XML::Writer;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 Video::CPL::Target - Create and modify Target objects.
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 and modify Target objects. These can also be created by helper functions at a higher level.
25  
26 =head1 SUBROUTINES/METHODS
27  
28 =cut
29  
30 1 our @FIELDS = qw(cuePointRef association modal);
31  
32 #cuePointRef : new model is that this is a string
33  
34 =head2 cuePointRef([$string])
35  
36 Accessor method to get or set cuePointRef.
37  
38 =cut
39  
40 0 ▶sub cuePointRef { my $obj = shift; $obj->{cuePointRef} = shift if @_; return $obj->{cuePointRef};};
Subroutine cuePointRef: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
41  
42 =head2 association([$string])
43  
44 Accessor method to get or set association.
45  
46 =cut
47  
48 0 ▶sub association { my $obj = shift; $obj->{association} = shift if @_; return $obj->{association};};
Subroutine association: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
49  
50 =head2 modal([$tf])
51  
52 Accessor method to get or set modal.
53  
54 =cut
55  
56 0 ▶sub modal { my $obj = shift; $obj->{modal} = shift if @_; return $obj->{modal};};
Subroutine modal: not called CC=2 SCAR=17.9
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
57  
58 =head2 new([cuePointRef=>$cpr,association=>$assoc,modal=>$tf])
59  
60 Create a new Target object.
61  
62 =cut
63  
64 4 ▶sub new {
Subroutine new: called CC=5 SCAR=16.1
Pod documented
65 4 my $pkg = shift;
66 4 my %p = @_;
67 4 my $ret = {};
68 4 bless $ret,$pkg;
69 4 foreach my $x (@FIELDS){
70 12 ▶ $ret->{$x} = $p{$x} if defined $p{$x};
Branch: 1 branch
BranchTrueFalseTotal
if defined $p{$x} 4 8 12
71 }
72 4 foreach my $x (keys %p){
73 4 ▶ confess("Parameter ('$x') given to Video::CPL::Target::new, but not understood\n") if !defined $ret->{$x};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ret->{$x} 0 4 4
74 }
75 4 return $ret;
76 }
77  
78 =head2 xmlo
79
80 Given an XML::Writer object, add the xml information for this Target.
81  
82 =cut
83  
84 2 ▶sub xmlo {
Subroutine xmlo: called CC=3 SCAR=11.0
Pod documented
85 2 my $obj = shift;
86 2 my $xo = shift;
87 2 my %p;
88 2 foreach my $x (@FIELDS){
89 6 ▶ $p{$x} = $obj->{$x} if defined $obj->{$x};
Branch: 1 branch
BranchTrueFalseTotal
if defined $obj->{$x} 2 4 6
90 }
91 2 $xo->emptyTag("target",%p);
92 }
93  
94 =head2 xml()
95  
96 Return the xml format of a Target object.
97  
98 =cut
99  
100 0 ▶sub xml {
Subroutine xml: not called CC=1 SCAR=6.9
Pod documented
101 0 my $obj = shift;
102 0 my $a;
103 0 my $xo = new XML::Writer(OUTPUT=>\$a);
104 0 $obj->xmlo($xo);
105 0 $xo->end();
106 0 return $a;
107 }
108  
109 =head2 fromxml()
110  
111 =cut
112  
113 2 ▶sub fromxml {
Subroutine fromxml: called CC=3 SCAR=11.0
Pod documented
114 2 my $s = shift;
115 2 my %s = %{$s};
116 2 my %p;
117 2 foreach my $q (@FIELDS){
118 6 ▶ $p{$q} = $s{$q} if defined $s{$q};
Branch: 1 branch
BranchTrueFalseTotal
if defined $s{$q} 2 4 6
119 }
120 2 return new Video::CPL::Target(%p);
121 }
122  
123 =head1 AUTHOR
124  
125 Carl Rosenberg, C<< <perl at coincident.tv> >>
126  
127 =head1 BUGS
128  
129 Please report any bugs or feature requests to Coincident TV.
130  
131 =head1 SUPPORT
132  
133 You can find documentation for this module with the perldoc command.
134  
135 perldoc Video::CPL::Target
136  
137 =head1 LICENSE AND COPYRIGHT
138  
139 Copyright 2010 Coincident TV
140  
141 Licensed under the Apache License, Version 2.0 (the "License");
142 you may not use this file except in compliance with the License.
143 You may obtain a copy of the License at
144  
145 http://www.apache.org/licenses/LICENSE-2.0
146  
147 Unless required by applicable law or agreed to in writing, software
148 distributed under the License is distributed on an "AS IS" BASIS,
149 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
150 See the License for the specific language governing permissions and
151 limitations under the License.
152  
153 =cut
154  
155 1 1;
« CPL/TargetList.pm ↑ Summary CPL/Story.pm »