| 1 | package Video::CPL::TargetList; | ||||||||||
| 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 Video::CPL::Target; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use XML::Writer; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 1 | ▶ | use Data::Dumper; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | =head1 NAME | ||||||||||
| 12 | |||||||||||
| 13 | Video::CPL::TargetList | ||||||||||
| 14 | |||||||||||
| 15 | =head1 VERSION | ||||||||||
| 16 | |||||||||||
| 17 | Version 0.10 | ||||||||||
| 18 | |||||||||||
| 19 | =cut | ||||||||||
| 20 | |||||||||||
| 21 | 1 | our $VERSION = '0.10'; | |||||||||
| 22 | |||||||||||
| 23 | =head1 SYNOPSIS | ||||||||||
| 24 | |||||||||||
| 25 | Create and modify TargetList objects. Usually invoked from within Video::CPL. | ||||||||||
| 26 | |||||||||||
| 27 | =head1 SUBROUTINES/METHODS | ||||||||||
| 28 | |||||||||||
| 29 | =cut | ||||||||||
| 30 | |||||||||||
| 31 | 1 | our @FIELDS = qw(backgroundPicLoc headerText operation target); | |||||||||
| 32 | |||||||||||
| 33 | =head2 backgroundPicLoc([$url]) | ||||||||||
| 34 | |||||||||||
| 35 | Accessor method to get or set backgroundPicLoc. | ||||||||||
| 36 | |||||||||||
| 37 | =cut | ||||||||||
| 38 | |||||||||||
| 39 | 0 | ▶ | sub backgroundPicLoc { my $obj = shift; $obj->{backgroundPicLoc} = shift if @_; return $obj->{backgroundPicLoc};}; | ||||||||
|
Subroutine
backgroundPicLoc: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 40 | |||||||||||
| 41 | =head2 headerText([$text]) | ||||||||||
| 42 | |||||||||||
| 43 | Accessor method to get or set headerText. | ||||||||||
| 44 | |||||||||||
| 45 | =cut | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub headerText { my $obj = shift; $obj->{headerText} = shift if @_; return $obj->{headerText};}; | ||||||||
|
Subroutine
headerText: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 48 | |||||||||||
| 49 | =head2 operation([$operation]) | ||||||||||
| 50 | |||||||||||
| 51 | Accessor method to get or set operation. | ||||||||||
| 52 | |||||||||||
| 53 | =cut | ||||||||||
| 54 | |||||||||||
| 55 | 0 | ▶ | sub operation { my $obj = shift; $obj->{operation} = shift if @_; return $obj->{operation};}; | ||||||||
|
Subroutine
operation: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 56 | |||||||||||
| 57 | =head2 target([$target]) | ||||||||||
| 58 | |||||||||||
| 59 | Accessor method to get or set target. | ||||||||||
| 60 | |||||||||||
| 61 | =cut | ||||||||||
| 62 | |||||||||||
| 63 | 0 | ▶ | sub target { my $obj = shift; $obj->{target} = shift if @_; return $obj->{target};}; | ||||||||
|
Subroutine
target: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||
| 64 | |||||||||||
| 65 | =head2 new([backgroundPicLoc=>$url,headerText=>$text,operation=>$op,target=>$target]) | ||||||||||
| 66 | |||||||||||
| 67 | Create a new TargetList object. | ||||||||||
| 68 | |||||||||||
| 69 | =cut | ||||||||||
| 70 | |||||||||||
| 71 | 2 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||
| 72 | 2 | my $pkg = shift; | |||||||||
| 73 | 2 | my %parms = @_; | |||||||||
| 74 | 2 | my $ret = {}; | |||||||||
| 75 | 2 | bless $ret,$pkg; | |||||||||
| 76 | |||||||||||
| 77 | 2 | foreach my $x (@FIELDS){ | |||||||||
| 78 | 8 | ▶ | $ret->{$x} = $parms{$x} if defined $parms{$x}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 79 | } | ||||||||||
| 80 | 2 | foreach my $x (keys %parms){ | |||||||||
| 81 | 2 | ▶ | confess("Parameter ('$x') given to Video::CPL::TargetList::new, but not understood\n") if !defined $ret->{$x}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | 2 | return $ret; | |||||||||
| 85 | } | ||||||||||
| 86 | |||||||||||
| 87 | =head2 xmlo | ||||||||||
| 88 | |||||||||||
| 89 | Given an XML::Writer object, add the xml information for this TargetList. | ||||||||||
| 90 | |||||||||||
| 91 | =cut | ||||||||||
| 92 | |||||||||||
| 93 | 1 | ▶ | sub xmlo { | ||||||||
|
Subroutine
xmlo: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||
| 94 | 1 | my $obj = shift; | |||||||||
| 95 | 1 | my $xo = shift; | |||||||||
| 96 | 1 | my %p; | |||||||||
| 97 | 1 | foreach my $x (@FIELDS){ | |||||||||
| 98 | 4 | ▶ | next if $x eq "target"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 99 | 3 | ▶ | $p{$x} = $obj->{$x} if defined $obj->{$x}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 100 | } | ||||||||||
| 101 | 1 | $xo->startTag("targetList",%p); | |||||||||
| 102 | 1 | foreach my $c (@{$obj->{target}}){ #if we are a targetList we must have target | |||||||||
| 103 | #print "Video::CPL::TargetList::xmlo in loop\n".Dumper($xo); | ||||||||||
| 104 | 1 | $c->xmlo($xo); | |||||||||
| 105 | } | ||||||||||
| 106 | 1 | $xo->endTag("targetList"); | |||||||||
| 107 | } | ||||||||||
| 108 | |||||||||||
| 109 | =head2 xml() | ||||||||||
| 110 | |||||||||||
| 111 | Return the xml format of a TargetList object. | ||||||||||
| 112 | |||||||||||
| 113 | =cut | ||||||||||
| 114 | |||||||||||
| 115 | 0 | ▶ | sub xml { | ||||||||
|
Subroutine
xml: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 116 | 0 | my $obj = shift; | |||||||||
| 117 | 0 | my $a; | |||||||||
| 118 | 0 | my $xo = new XML::Writer(OUTPUT=>\$a); | |||||||||
| 119 | 0 | $obj->xmlo($xo); | |||||||||
| 120 | 0 | $xo->end(); | |||||||||
| 121 | 0 | return $a; | |||||||||
| 122 | } | ||||||||||
| 123 | |||||||||||
| 124 | =head2 fromxml() | ||||||||||
| 125 | |||||||||||
| 126 | =cut | ||||||||||
| 127 | |||||||||||
| 128 | 1 | ▶ | sub fromxml { | ||||||||
|
Subroutine
fromxml: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||
| 129 | 1 | my $s = shift; | |||||||||
| 130 | 1 | my %s = %{$s}; | |||||||||
| 131 | 1 | my %parms; | |||||||||
| 132 | 1 | foreach my $q (@FIELDS){ | |||||||||
| 133 | 4 | ▶ | next if $q eq "target"; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 134 | 3 | ▶ | $parms{$q} = $s{$q} if defined($s{$q}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 135 | } | ||||||||||
| 136 | #process targets | ||||||||||
| 137 | 1 | my @t; | |||||||||
| 138 | 1 | foreach my $x (@{$s{target}}){ | |||||||||
| 139 | 1 | push @t,Video::CPL::Target::fromxml($x); | |||||||||
| 140 | } | ||||||||||
| 141 | 1 | $parms{target} = \@t; | |||||||||
| 142 | 1 | return new Video::CPL::TargetList(%parms); | |||||||||
| 143 | } | ||||||||||
| 144 | |||||||||||
| 145 | =head1 AUTHOR | ||||||||||
| 146 | |||||||||||
| 147 | Carl Rosenberg, C<< <perl at coincident.tv> >> | ||||||||||
| 148 | |||||||||||
| 149 | =head1 BUGS | ||||||||||
| 150 | |||||||||||
| 151 | Please report any bugs or feature requests to Coincident TV. | ||||||||||
| 152 | |||||||||||
| 153 | =head1 SUPPORT | ||||||||||
| 154 | |||||||||||
| 155 | You can find documentation for this module with the perldoc command. | ||||||||||
| 156 | |||||||||||
| 157 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 158 | |||||||||||
| 159 | Copyright 2010 Coincident TV | ||||||||||
| 160 | |||||||||||
| 161 | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||
| 162 | you may not use this file except in compliance with the License. | ||||||||||
| 163 | You may obtain a copy of the License at | ||||||||||
| 164 | |||||||||||
| 165 | http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||
| 166 | |||||||||||
| 167 | Unless required by applicable law or agreed to in writing, software | ||||||||||
| 168 | distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||
| 169 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||
| 170 | See the License for the specific language governing permissions and | ||||||||||
| 171 | limitations under the License. | ||||||||||
| 172 | |||||||||||
| 173 | =cut | ||||||||||
| 174 | |||||||||||
| 175 | 1 | 1; | |||||||||