| 1 | package XML::ASX::Entry; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use vars qw($VERSION $AUTOLOAD %ASX_SLOTS @ISA); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | @ISA = qw(XML::ASX); | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use overload '""' => \&xml; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | my %RW_SLOTS = ( | |||||||||||||||||||||||||||
| 13 | title => '', | ||||||||||||||||||||||||||||
| 14 | moreinfo => '', | ||||||||||||||||||||||||||||
| 15 | target => '', | ||||||||||||||||||||||||||||
| 16 | duration => '', | ||||||||||||||||||||||||||||
| 17 | copyright => '', | ||||||||||||||||||||||||||||
| 18 | base => '', | ||||||||||||||||||||||||||||
| 19 | author => '', | ||||||||||||||||||||||||||||
| 20 | abstract => '', | ||||||||||||||||||||||||||||
| 21 | clientskip => 'YES', | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | duration => '00:00:00.00', | ||||||||||||||||||||||||||||
| 24 | previewduration => '', | ||||||||||||||||||||||||||||
| 25 | banner => '', | ||||||||||||||||||||||||||||
| 26 | logo_icon => '', | ||||||||||||||||||||||||||||
| 27 | logo_mark => '', | ||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 51 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 31 | 51 | my $self = shift; | |||||||||||||||||||||||||||
| 32 | 51 | my $param = $AUTOLOAD; | |||||||||||||||||||||||||||
| 33 | 51 | $param =~ s/.*:://; | |||||||||||||||||||||||||||
| 34 | 51 | ▶ | die(__PACKAGE__." doesn't implement $param") unless defined($RW_SLOTS{$param}) or defined($ASX_SLOTS{$param}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $RW_SLOTS{$param} or defined $XML::ASX::Entry::ASX_SLOTS{$param}
MC/DC50%1/2
defined $RW_SLOTS{$param} or defined $XML::ASX::Entry::ASX_SLOTS{$param}
defined $RW_SLOTS{$param}
defined $XML::ASX::Entry::ASX_SLOTS{$param}
Truth table66%2/3
A or B
A= defined $RW_SLOTS{$param}B= defined $XML::ASX::Entry::ASX_SLOTS{$param}
| |||||||||||||||||||||||||||||
| 35 | 49 | ▶ | $self->{$param} = shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 49 | return $self->{$param}; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 2 | my $class = shift; | |||||||||||||||||||||||||||
| 41 | 2 | my %param = @_; | |||||||||||||||||||||||||||
| 42 | 2 | my $self = bless {}, $class; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 2 | $self->$_($ASX_SLOTS{$_}) foreach keys %ASX_SLOTS; | |||||||||||||||||||||||||||
| 45 | 2 | $self->$_($RW_SLOTS{$_}) foreach keys %RW_SLOTS; | |||||||||||||||||||||||||||
| 46 | 2 | $self->$_($param{$_}) foreach keys %param; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 2 | return $self; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 2 | ▶ | sub add_ref { | ||||||||||||||||||||||||||
|
Subroutine
add_ref: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 52 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 53 | 2 | ▶ | push @{$self->{refs}}, shift if @_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 2 | return $self->{refs}->[scalar @{$self->{refs}} - 1]; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 1 | ▶ | sub each_ref { | ||||||||||||||||||||||||||
|
Subroutine
each_ref: called CC=2 SCAR=8.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 58 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 59 | 0 | ▶ | return $self->{refs} ? @{$self->{refs}} : (); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 1 | ▶ | sub xml { | ||||||||||||||||||||||||||
|
Subroutine
xml: called CC=15 SCAR=30.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 63 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 1 | ▶ | die __PACKAGE__.': clientskip() must be "YES" or "NO"' if ($self->clientskip ne 'YES' and $self->clientskip ne 'NO'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->clientskip ne "YES" and $self->clientskip ne "NO"
MC/DC0%0/2
$self->clientskip ne "YES" and $self->clientskip ne "NO"
$self->clientskip ne "YES"
$self->clientskip ne "NO"
Truth table33%1/3
A and B
A= $self->clientskip ne "YES"B= $self->clientskip ne "NO"
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 1 | my $refstr = ''; | |||||||||||||||||||||||||||
| 68 | 1 | foreach my $ref ($self->each_ref){ | |||||||||||||||||||||||||||
| 69 | 0 | $refstr .= $self->entag('Ref','',{href=>$ref},1); | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 1 | my $paramstr = ''; | |||||||||||||||||||||||||||
| 73 | 1 | my %param = $self->each_param; | |||||||||||||||||||||||||||
| 74 | 1 | foreach my $key (keys %param){ | |||||||||||||||||||||||||||
| 75 | 0 | $paramstr .= $self->entag('PARAM','',{NAME=>$key,VALUE=>$param{$key}},1); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 1 | my $bannercontent = ''; | |||||||||||||||||||||||||||
| 79 | 1 | ▶ | $bannercontent .= $self->entag('MoreInfo','',{href=>$self->moreinfo,target=>$self->target},1) if $self->moreinfo; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 1 | ▶ | $bannercontent .= $self->entag('Abstract',$self->abstract) if $self->abstract; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | 1 | my $content = ''; | |||||||||||||||||||||||||||
| 83 | 1 | ▶ | $content .= $self->entag('Duration','',{value=>$self->duration},1) if $self->duration; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 84 | 1 | ▶ | $content .= $self->entag('PreviewDuration','',{value=>$self->duration},1) if $self->previewduration; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 85 | 1 | ▶ | $content .= $self->entag('Title',$self->title) if $self->title; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 86 | 1 | ▶ | $content .= $self->entag('Copyright',$self->copyright) if $self->copyright; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 87 | 1 | ▶ | $content .= $self->entag('Logo','',{href=>$self->logo_icon,Style=>'ICON'},1) if $self->logo_icon; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 88 | 1 | ▶ | $content .= $self->entag('Logo','',{href=>$self->logo_mark,Style=>'MARK'},1) if $self->logo_mark; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 89 | 1 | ▶ | $content .= $self->entag('MoreInfo','',{href=>$self->moreinfo,target=>$self->target},1) if $self->moreinfo; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 90 | 1 | ▶ | $content .= $self->entag('Banner',$bannercontent,{href=>$self->banner}) if $self->banner; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | 1 | $content .= $refstr; | |||||||||||||||||||||||||||
| 92 | 1 | $content .= $paramstr; | |||||||||||||||||||||||||||
| 93 | 1 | return $self->entag('Entry', | |||||||||||||||||||||||||||
| 94 | $content, | ||||||||||||||||||||||||||||
| 95 | {ClientSkip => $self->clientskip},0 | ||||||||||||||||||||||||||||
| 96 | ); | ||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 1 | 1; | |||||||||||||||||||||||||||
| 100 | __END__ | ||||||||||||||||||||||||||||