| 1 | package Video::CPL::MXMLField; | ||||||||||||||||||||||||||||
| 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 XML::Writer; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | Video::CPL::MXMLField - Video::CPL::MXMLField object. | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =head1 VERSION | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | Version 0.10 | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =cut | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | our $VERSION = '0.10'; | |||||||||||||||||||||||||||
| 19 | 1 | my @FIELDS = qw(click color data dataProfider editable fontSize fontWidth height horizontalCenter horizontalScrollPolicy id item label leading scaleContent source source text verticalCenter verticalScrollPolicy width x y); | |||||||||||||||||||||||||||
| 20 | 1 | my @KINDS = qw(mx:CheckBox mx:ComboBox mx:RadioButton mx:Button mx:Image mx:Label mx:TextInput mx:Text); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | This is mostly an internal package for CPL.pm. You can use it directly, but it is recommended to use the cue point creation routines in CPL.pm. | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | use Video::CPL::MXMLField; | ||||||||||||||||||||||||||||
| 27 | my $foo = Video::CPL::MXMLField->new(); | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | =head1 METHODS/METHODS | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | =cut | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | =head2 new($kind,%parms) | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | Create a new Video::CPL::MXMLField object. | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =cut | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 40 | 0 | my $pkg = shift; | |||||||||||||||||||||||||||
| 41 | 0 | my $kind = shift; | |||||||||||||||||||||||||||
| 42 | 0 | my %parms = @_; | |||||||||||||||||||||||||||
| 43 | 0 | my $ret = {}; | |||||||||||||||||||||||||||
| 44 | 0 | bless $ret,$pkg; | |||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 0 | $ret->{kind} = $kind; | |||||||||||||||||||||||||||
| 47 | 0 | foreach my $x (@FIELDS){ | |||||||||||||||||||||||||||
| 48 | 0 | ▶ | if (defined($parms{$x})){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 0 | $ret->{$x} = $parms{$x}; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | #check | ||||||||||||||||||||||||||||
| 53 | 0 | foreach my $x (keys %parms){ | |||||||||||||||||||||||||||
| 54 | 0 | ▶ | confess("Parameter ('$x') value ($parms{$x}) given to Video::CPL::MXMLField::new, but not understood\n") if defined($parms{$x}) && !defined($ret->{$x}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $parms{$x} and not defined $ret->{$x}
MC/DC0%0/2
defined $parms{$x} and not defined $ret->{$x}
defined $parms{$x}
not defined $ret->{$x}
Truth table0%0/3
A and not(B)
A= defined $parms{$x}B= not defined $ret->{$x}
| |||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | 0 | return $ret; | |||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =head2 xmlo | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | Given an XML::Writer object, add the xml information for this Layout. | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =cut | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | ▶ | sub xmlo { | ||||||||||||||||||||||||||
|
Subroutine
xmlo: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 66 | 0 | my $obj = shift; | |||||||||||||||||||||||||||
| 67 | 0 | my $xo = shift; | |||||||||||||||||||||||||||
| 68 | 0 | my $kind = $obj->{kind}; | |||||||||||||||||||||||||||
| 69 | 0 | my %p; | |||||||||||||||||||||||||||
| 70 | 0 | foreach my $x (@FIELDS){ | |||||||||||||||||||||||||||
| 71 | 0 | ▶ | $p{$x} = $obj->{$x} if defined $obj->{$x}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | 0 | $xo->emptyTag($kind,%p); | |||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head2 xml() | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | Return the xml format of a Video::CPL::MXMLField object. | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | =cut | ||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 0 | ▶ | sub xml { | ||||||||||||||||||||||||||
|
Subroutine
xml: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 83 | 0 | my $obj = shift; | |||||||||||||||||||||||||||
| 84 | 0 | my $a; | |||||||||||||||||||||||||||
| 85 | 0 | my $xo = new XML::Writer(OUTPUT=>\$a); | |||||||||||||||||||||||||||
| 86 | 0 | $obj->xmlo($xo); | |||||||||||||||||||||||||||
| 87 | 0 | $xo->end(); | |||||||||||||||||||||||||||
| 88 | 0 | return $a; | |||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | =head2 fromxml(\%hash) | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | Return a Video::CPL::MXMLField object given that part of the parse tree from XML::Simple::XMLin. | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | =cut | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 0 | ▶ | sub fromxml { | ||||||||||||||||||||||||||
|
Subroutine
fromxml: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 98 | 0 | my $s = shift; | |||||||||||||||||||||||||||
| 99 | 0 | my %s = %{$s}; | |||||||||||||||||||||||||||
| 100 | 0 | my %parms; | |||||||||||||||||||||||||||
| 101 | 0 | foreach my $q (@FIELDS){ | |||||||||||||||||||||||||||
| 102 | 0 | ▶ | $parms{$q} = $s{$q} if defined($s{$q}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | #how do we get our "kind"? | ||||||||||||||||||||||||||||
| 105 | 0 | return new Video::CPL::MXMLField(%parms); | |||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||
| 111 | Carl Rosenberg, C<< <perl at coincident.tv> >> | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | =head1 BUGS | ||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||
| 115 | Please report any bugs or feature requests to Coincident TV. | ||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||
| 117 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||
| 119 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | perldoc Video::CPL::MXMLField | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | Copyright 2010 Coincident TV | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||
| 128 | you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||
| 129 | You may obtain a copy of the License at | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||
| 134 | distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||
| 135 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||
| 136 | See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||
| 137 | limitations under the License. | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | =cut | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 1 | 1; # End of Video::CPL::MXMLField | |||||||||||||||||||||||||||