| 1 | package Video::CPL::Story; | ||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 8 | =head1 NAME | ||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | Video::CPL::Story - Video::CPL::Story object. | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =head1 VERSION | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | Version 0.10 | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =cut | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 1 | our $VERSION = '0.10'; | |||||||||||||||||||||||||||
| 19 | 1 | our @FIELDS = qw(alpha balloonText forever picLoc picOverLoc); | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 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. | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | use Video::CPL::Story; | ||||||||||||||||||||||||||||
| 26 | my $foo = Video::CPL::Story->new(balloonText=>"Hello"); | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =head1 METHODS/METHODS | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =cut | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =head2 new([alpha=>$value,balloonText=>$string,forever=>"false",picLoc=$url,picOverLoc=>$url]) | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | Create a new Video::CPL::Story object. | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =cut | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 3 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=6 SCAR=18.3
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | 3 | my $pkg = shift; | |||||||||||||||||||||||||||
| 40 | 3 | my %p = @_; | |||||||||||||||||||||||||||
| 41 | 3 | my $ret = {}; | |||||||||||||||||||||||||||
| 42 | 3 | bless $ret,$pkg; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 3 | foreach my $x (@FIELDS){ | |||||||||||||||||||||||||||
| 45 | 15 | ▶ | $ret->{$x} = $p{$x} if defined $p{$x}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 3 | foreach my $x (keys %p){ | |||||||||||||||||||||||||||
| 49 | 9 | ▶ | confess("Parameter ('$x') value ($p{$x}) given to Video::CPL::Story::new, but not understood\n") if defined($p{$x}) && !defined($ret->{$x}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $p{$x} and not defined $ret->{$x}
MC/DC0%0/2
defined $p{$x} and not defined $ret->{$x}
defined $p{$x}
not defined $ret->{$x}
Truth table33%1/3
A and not(B)
A= defined $p{$x}B= not defined $ret->{$x}
| |||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 3 | return $ret; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =head2 xmlo | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | Given an XML::Writer object, add the xml information for this Layout. | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | =cut | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 1 | ▶ | sub xmlo { | ||||||||||||||||||||||||||
|
Subroutine
xmlo: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 61 | 1 | my $obj = shift; | |||||||||||||||||||||||||||
| 62 | 1 | my $xo = shift; | |||||||||||||||||||||||||||
| 63 | 1 | my %p; | |||||||||||||||||||||||||||
| 64 | 1 | foreach my $x (@FIELDS){ | |||||||||||||||||||||||||||
| 65 | 5 | ▶ | $p{$x} = $obj->{$x} if defined $obj->{$x}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||
| 67 | 1 | $xo->emptyTag("story",%p); | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | =head2 xml() | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | Return the xml format of a Video::CPL::Story object. | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | =cut | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub xml { | ||||||||||||||||||||||||||
|
Subroutine
xml: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 77 | 0 | my $obj = shift; | |||||||||||||||||||||||||||
| 78 | 0 | my $a; | |||||||||||||||||||||||||||
| 79 | 0 | my $xo = new XML::Writer(OUTPUT=>\$a); | |||||||||||||||||||||||||||
| 80 | 0 | $obj->xmlo($xo); | |||||||||||||||||||||||||||
| 81 | 0 | $xo->end(); | |||||||||||||||||||||||||||
| 82 | 0 | return $a; | |||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | =head2 fromxml(\%hash) | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | Return a Video::CPL::Story object given that part of the parse tree from XML::Simple::XMLin. | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | =cut | ||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 1 | ▶ | sub fromxml { | ||||||||||||||||||||||||||
|
Subroutine
fromxml: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||
| 92 | 1 | my $s = shift; | |||||||||||||||||||||||||||
| 93 | 1 | my %s = %{$s}; | |||||||||||||||||||||||||||
| 94 | 1 | my %p; | |||||||||||||||||||||||||||
| 95 | 1 | foreach my $q (@FIELDS){ | |||||||||||||||||||||||||||
| 96 | 5 | ▶ | $p{$q} = $s{$q} if defined $s{$q}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | 1 | foreach my $q (keys %s){ | |||||||||||||||||||||||||||
| 99 | 4 | ▶ | confess "Video::CPL::Story::fromxml confused by key ($q)\n" if !defined($p{$q}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | 1 | return new Video::CPL::Story(%p); | |||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | =head2 alpha([$string]) | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | Accessor function to set or return C<alpha>. | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | =cut | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 0 | ▶ | sub alpha { my $obj = shift; $obj->{alpha} = shift if @_; return $obj->{alpha}; } | ||||||||||||||||||||||||||
|
Subroutine
alpha: not called CC=2 SCAR=17.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | =head2 balloonText([$string]) | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | Accessor function to set or return C<balloonText>. | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | =cut | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 2 | ▶ | sub balloonText { my $obj = shift; $obj->{balloonText} = shift if @_; return $obj->{balloonText}; } | ||||||||||||||||||||||||||
|
Subroutine
balloonText: called CC=2 SCAR=7.1
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | =head2 forever([$string]) | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | Accessor function to set or return the boolean B<forever>. Values are in text, "true" or "false". | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | =cut | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 2 | ▶ | sub forever { my $obj = shift; $obj->{forever} = shift if @_; return $obj->{forever}; } | ||||||||||||||||||||||||||
|
Subroutine
forever: called CC=2 SCAR=7.1
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||
| 128 | =head2 picLoc([$url]) | ||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | Accessor function to set or return the B<picLoc>. This should be a local or remote URL, e.g. | ||||||||||||||||||||||||||||
| 131 | C<http://www.foo.com/x.jpg> or C<x.jpg> | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | =cut | ||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 2 | ▶ | sub picLoc { my $obj = shift; $obj->{picLoc} = shift if @_; return $obj->{picLoc}; } | ||||||||||||||||||||||||||
|
Subroutine
picLoc: called CC=2 SCAR=7.1
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||
| 137 | =head2 picOverLoc([$url]) | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | Accessor function to set or return the B<picOverLoc>, the image to be displayed when the mouse is over the image.. This should be a local or remote URL, e.g. | ||||||||||||||||||||||||||||
| 140 | C<http://www.foo.com/x.jpg> or C<x.jpg> | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | =cut | ||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||
| 144 | 2 | ▶ | sub picOverLoc { my $obj = shift; $obj->{picOverLoc} = shift if @_; return $obj->{picOverLoc}; } | ||||||||||||||||||||||||||
|
Subroutine
picOverLoc: called CC=2 SCAR=7.1
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||
| 146 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||
| 148 | Carl Rosenberg, C<< <perl at coincident.tv> >> | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | =head1 BUGS | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | Please report any bugs or feature requests to Coincident TV. | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||
| 156 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | perldoc Video::CPL::Story | ||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | Copyright 2010 Coincident TV | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||||||||||||||||||||||||
| 165 | you may not use this file except in compliance with the License. | ||||||||||||||||||||||||||||
| 166 | You may obtain a copy of the License at | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||
| 171 | distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||
| 172 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||||||||||||||||||
| 173 | See the License for the specific language governing permissions and | ||||||||||||||||||||||||||||
| 174 | limitations under the License. | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =cut | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 1 | 1; # End of Video::CPL::Story | |||||||||||||||||||||||||||