| 1 | package Video::CPL::MXML; | ||||||||||
| 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 | |||||||||||
| 6 | =head1 NAME | ||||||||||
| 7 | |||||||||||
| 8 | Video::CPL::MXML | ||||||||||
| 9 | |||||||||||
| 10 | =head1 VERSION | ||||||||||
| 11 | |||||||||||
| 12 | Version 0.10 | ||||||||||
| 13 | |||||||||||
| 14 | =cut | ||||||||||
| 15 | |||||||||||
| 16 | 1 | our $VERSION = '0.10'; | |||||||||
| 17 | |||||||||||
| 18 | |||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||
| 20 | |||||||||||
| 21 | Holding object for MXML objects. | ||||||||||
| 22 | |||||||||||
| 23 | =head1 SUBROUTINES/METHODS | ||||||||||
| 24 | |||||||||||
| 25 | =cut | ||||||||||
| 26 | |||||||||||
| 27 | 1 | my @FIELDS = qw(pauseOnOverlay xmlns:mx width height); | |||||||||
| 28 | |||||||||||
| 29 | =head2 new(%parms) | ||||||||||
| 30 | |||||||||||
| 31 | =cut | ||||||||||
| 32 | |||||||||||
| 33 | 0 | ▶ | sub new { | ||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||
| 34 | #given hash with parameters. | ||||||||||
| 35 | #fieldList is either an array of MXMLField objects or a single one. | ||||||||||
| 36 | 0 | my $pkg = shift; | |||||||||
| 37 | 0 | my %parms = @_; | |||||||||
| 38 | 0 | my $ret = {}; | |||||||||
| 39 | 0 | bless $ret,$pkg; | |||||||||
| 40 | |||||||||||
| 41 | 0 | foreach my $x (@FIELDS){ | |||||||||
| 42 | 0 | ▶ | $ret->{$x} = $parms{$x} if defined $parms{$x}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 43 | } | ||||||||||
| 44 | #if (defined $x->{fieldList}){ | ||||||||||
| 45 | # if (isa($x->{fieldList},'ARRAY')){ | ||||||||||
| 46 | # } else { | ||||||||||
| 47 | # } | ||||||||||
| 48 | # } | ||||||||||
| 49 | 0 | foreach my $x (keys %parms){ | |||||||||
| 50 | 0 | ▶ | confess("Parameter ('$x') given to Video::CPL::MXML::new, but not understood\n") if !defined $ret->{$x}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | 0 | return $ret; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub fromxml { | ||||||||
|
Subroutine
fromxml: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 57 | 0 | my $parent = shift; | |||||||||
| 58 | 0 | my $name = shift; | |||||||||
| 59 | 0 | my $s = shift; | |||||||||
| 60 | 0 | my %s = %{$s}; | |||||||||
| 61 | 0 | my %p; | |||||||||
| 62 | 0 | foreach my $k (@FIELDS){ | |||||||||
| 63 | 0 | ▶ | $p{$k} = $s{$k} if defined($s{$k}); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | } | ||||||||||
| 65 | #don't fully understand how this will show up in XML | ||||||||||
| 66 | #foreach (mxfields){ | ||||||||||
| 67 | # $f = Video::CPL::MXMLField::fromxml(); | ||||||||||
| 68 | # push @f; | ||||||||||
| 69 | #} | ||||||||||
| 70 | #$p{fieldList} = \@f; | ||||||||||
| 71 | 0 | return new Video::CPL::MXML(%p); | |||||||||
| 72 | } | ||||||||||
| 73 | |||||||||||
| 74 | #<mxmlInCPL pauseOnOverlay="true"> | ||||||||||
| 75 | # <mx:MXML xmlns:mx="http://www.adobe.com/2006/mxml"> | ||||||||||
| 76 | # <mx:Canvas width="720" height="508"> | ||||||||||
| 77 | 0 | ▶ | sub xmlo { | ||||||||
|
Subroutine
xmlo: not called CC=7 SCAR=40.3
Pod
undocumented
| |||||||||||
| 78 | 0 | my $obj = shift; | |||||||||
| 79 | 0 | my $xo = shift; | |||||||||
| 80 | 0 | my %p; | |||||||||
| 81 | 0 | ▶ | $p{pauseOnOverlay} = $obj->{pauseOnOverlay} if defined $obj->{pauseOnOverlay}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 82 | 0 | $xo->startTag("mxmlInCPL",%p); | |||||||||
| 83 | 0 | %p = undef; | |||||||||
| 84 | 0 | ▶ | $p{"xmlns:mx"} = $obj->{"xmlns:mx"} if defined $obj->{"xmlns:mx"}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 85 | 0 | $xo->startTag("mx:MXML",%p); | |||||||||
| 86 | 0 | %p = undef; | |||||||||
| 87 | 0 | ▶ | $p{width} = $obj->{width} if defined $obj->{width}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 88 | 0 | ▶ | $p{height} = $obj->{height} if defined $obj->{height}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 89 | 0 | ▶ | if ($obj->{fieldList}){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 90 | 0 | foreach my $c (@{$obj->{fieldList}}){ | |||||||||
| 91 | 0 | $c->xmlo($xo); | |||||||||
| 92 | } | ||||||||||
| 93 | } | ||||||||||
| 94 | 0 | $xo->startTag("mx:Canvas",%p); | |||||||||
| 95 | 0 | $xo->endTag("mx:Canvas"); | |||||||||
| 96 | 0 | $xo->endTag("mx:MXML"); | |||||||||
| 97 | 0 | $xo->endTag("mxmlInCPL"); | |||||||||
| 98 | } | ||||||||||
| 99 | |||||||||||
| 100 | =head2 xml() | ||||||||||
| 101 | |||||||||||
| 102 | =cut | ||||||||||
| 103 | |||||||||||
| 104 | 0 | ▶ | sub xml { | ||||||||
|
Subroutine
xml: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 105 | 0 | my $obj = shift; | |||||||||
| 106 | 0 | my $a = ""; | |||||||||
| 107 | 0 | my $xo = new XML::Writer(OUTPUT=>\$a); | |||||||||
| 108 | 0 | $obj->xmlo($xo); | |||||||||
| 109 | 0 | $xo->end; | |||||||||
| 110 | 0 | return $a; | |||||||||
| 111 | } | ||||||||||
| 112 | |||||||||||
| 113 | #can only have | ||||||||||
| 114 | # Canvas,Image,Text,TextInput,Radiobutton fields. | ||||||||||
| 115 | # in linear non-nested order. Suggest they simply be routines within here. | ||||||||||
| 116 | =head1 AUTHOR | ||||||||||
| 117 | |||||||||||
| 118 | Carl Rosenberg, C<< <perl at coincident.tv> >> | ||||||||||
| 119 | |||||||||||
| 120 | =head1 BUGS | ||||||||||
| 121 | |||||||||||
| 122 | Please report any bugs or feature requests to C<bug-video-cpl at rt.cpan.org>, or through | ||||||||||
| 123 | the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Video-CPL>. I will be notified, and then you'll | ||||||||||
| 124 | automatically be notified of progress on your bug as I make changes. | ||||||||||
| 125 | |||||||||||
| 126 | =head1 SUPPORT | ||||||||||
| 127 | |||||||||||
| 128 | You can find documentation for this module with the perldoc command. | ||||||||||
| 129 | |||||||||||
| 130 | perldoc Video::CPL::MXML | ||||||||||
| 131 | |||||||||||
| 132 | |||||||||||
| 133 | =head1 ACKNOWLEDGEMENTS | ||||||||||
| 134 | |||||||||||
| 135 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 136 | |||||||||||
| 137 | Copyright 2010 Coincident TV | ||||||||||
| 138 | |||||||||||
| 139 | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||
| 140 | you may not use this file except in compliance with the License. | ||||||||||
| 141 | You may obtain a copy of the License at | ||||||||||
| 142 | |||||||||||
| 143 | http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||
| 144 | |||||||||||
| 145 | Unless required by applicable law or agreed to in writing, software | ||||||||||
| 146 | distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||
| 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||
| 148 | See the License for the specific language governing permissions and | ||||||||||
| 149 | limitations under the License. | ||||||||||
| 150 | |||||||||||
| 151 | =cut | ||||||||||
| 152 | |||||||||||
| 153 | 1 | 1; | |||||||||