ASX/File.pm

filter: Statementstmt 71.6% 53 / 74 Branchbran 11.5% 3 / 26 Conditioncond 41.6% 5 / 12 MC/DCmcdc 12.5% 1 / 8 Subroutinesub 91.6% 11 / 12 Podpod 0.0% 0 / 5 totaltotal 53.2% 73 / 137 CC 22 SCAR 42.9
CC
22
Cov
54%
xml
182.0
AUTOLOAD
4.1
new
4.0
CRAP 73.2
↑ Summary ASX/Entry.pm »
1 package XML::ASX::File;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use vars qw($VERSION $AUTOLOAD @ISA %ASX_SLOTS);
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 @ISA = qw(XML::ASX);
7  
8 1 ▶use XML::ASX::Entry;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use XML::ASX::Repeat;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use XML::ASX::Event;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use overload '""' => \&xml;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 $VERSION = '0.01';
15  
16 1 my %RW_SLOTS = (
17 title => '',
18 moreinfo => '',
19 target => '',
20 copyright => '',
21 base => '',
22 author => '',
23 abstract => '',
24  
25 version => '3.0',
26 previewmode => 'YES',
27 bannerbar => 'AUTO',
28  
29 banner => '',
30 logo_icon => '',
31 logo_mark => '',
32 );
33  
34 24 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=4 SCAR=14.0
35 24 my $self = shift;
36 24 my $param = $AUTOLOAD;
37 24 $param =~ s/.*:://;
38 24 ▶ die(__PACKAGE__." doesn't implement $param") unless defined($RW_SLOTS{$param}) or defined($ASX_SLOTS{$param});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $RW_SLOTS{$param} or defined $XML::ASX::File::ASX_SLOTS{$param} 1 23 24
Condition66%2/3
defined $RW_SLOTS{$param} or defined $XML::ASX::File::ASX_SLOTS{$param}
l!l&&r!l&&!r
2301
MC/DC50%1/2
defined $RW_SLOTS{$param} or defined $XML::ASX::File::ASX_SLOTS{$param}
defined $RW_SLOTS{$param} defined $XML::ASX::File::ASX_SLOTS{$param}
Truth table66%2/3
A or B
A= defined $RW_SLOTS{$param}B= defined $XML::ASX::File::ASX_SLOTS{$param}
ABresult
1X1
011
000
39 23 ▶ $self->{$param} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 23 0 23
40 23 return $self->{$param};
41 }
42  
43 1 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
44 1 my $class = shift;
45 1 my %param = @_;
46 1 my $self = bless {}, $class;
47  
48 1 $self->$_($ASX_SLOTS{$_}) foreach keys %ASX_SLOTS;
49 1 $self->$_($RW_SLOTS{$_}) foreach keys %RW_SLOTS;
50 1 $self->$_($param{$_}) foreach keys %param;
51  
52 1 return $self;
53 }
54  
55 1 ▶sub add_repeat {
Subroutine add_repeat: called CC=2 SCAR=7.1
Pod undocumented
56 1 my $self = shift;
57 1 ▶ my $repeat = shift || XML::ASX::Repeat->new;
Condition33%1/3
shift() || 'XML::ASX::Repeat'->new
l!l&&r!l&&!r
010
MC/DC0%0/2
shift() || 'XML::ASX::Repeat'->new
shift() 'XML::ASX::Repeat'->new
Truth table33%1/3
A || B
A= shift()B= 'XML::ASX::Repeat'->new
ABresult
1X1
011
000
58 1 push @{$self->{queue}}, $repeat;
59  
60 1 return $self->{queue}->[scalar @{$self->{queue}} - 1];
61 }
62  
63 1 ▶sub add_entry {
Subroutine add_entry: called CC=2 SCAR=7.1
Pod undocumented
64 1 my $self = shift;
65 1 ▶ my $entry = shift || XML::ASX::Entry->new;
Condition33%1/3
shift() || 'XML::ASX::Entry'->new
l!l&&r!l&&!r
010
MC/DC0%0/2
shift() || 'XML::ASX::Entry'->new
shift() 'XML::ASX::Entry'->new
Truth table33%1/3
A || B
A= shift()B= 'XML::ASX::Entry'->new
ABresult
1X1
011
000
66 1 push @{$self->{queue}}, $entry;
67  
68 1 return $self->{queue}->[scalar @{$self->{queue}} - 1];
69 }
70  
71 1 ▶sub add_event {
Subroutine add_event: called CC=2 SCAR=7.1
Pod undocumented
72 1 my $self = shift;
73 1 ▶ my $event = shift || XML::ASX::Event->new;
Condition33%1/3
shift() || 'XML::ASX::Event'->new
l!l&&r!l&&!r
010
MC/DC0%0/2
shift() || 'XML::ASX::Event'->new
shift() 'XML::ASX::Event'->new
Truth table33%1/3
A || B
A= shift()B= 'XML::ASX::Event'->new
ABresult
1X1
011
000
74 1 push @{$self->{queue}}, $event;
75  
76 1 return $self->{queue}->[scalar @{$self->{queue}} - 1];
77 }
78  
79 0 ▶sub xml {
Subroutine xml: not called CC=13 SCAR=52.0
Pod undocumented
80 0 my $self = shift;
81  
82 0 my $paramstr = '';
83 0 my %param = $self->each_param;
84 0 foreach my $key (keys %param){
85 0 $paramstr .= $self->entag('PARAM','',{NAME=>$key,VALUE=>$param{$key}},1);
86 }
87  
88 0 my $bannercontent = '';
89 0 ▶ $bannercontent .= $self->entag('MoreInfo','',{href=>$self->moreinfo,target=>$self->target},1) if $self->moreinfo;
Branch: 1 branch
BranchTrueFalseTotal
if $self->moreinfo 0 0 0
90 0 ▶ $bannercontent .= $self->entag('Abstract',$self->abstract) if $self->abstract;
Branch: 1 branch
BranchTrueFalseTotal
if $self->abstract 0 0 0
91  
92 0 my $content = '';
93 0 ▶ $content .= $self->entag('ABSTRACT',$self->abstract) if $self->abstract;
Branch: 1 branch
BranchTrueFalseTotal
if $self->abstract 0 0 0
94 0 ▶ $content .= $self->entag('TITLE',$self->title) if $self->title;
Branch: 1 branch
BranchTrueFalseTotal
if $self->title 0 0 0
95 0 ▶ $content .= $self->entag('AUTHOR',$self->author) if $self->author;
Branch: 1 branch
BranchTrueFalseTotal
if $self->author 0 0 0
96 0 ▶ $content .= $self->entag('BASE','',{href=>$self->base}) if $self->base;
Branch: 1 branch
BranchTrueFalseTotal
if $self->base 0 0 0
97 0 ▶ $content .= $self->entag('COPYRIGHT',$self->copyright) if $self->copyright;
Branch: 1 branch
BranchTrueFalseTotal
if $self->copyright 0 0 0
98 0 ▶ $content .= $self->entag('Logo','',{href=>$self->logo_icon,style=>'ICON'},1) if $self->logo_icon;
Branch: 1 branch
BranchTrueFalseTotal
if $self->logo_icon 0 0 0
99 0 ▶ $content .= $self->entag('Logo','',{href=>$self->logo_mark,style=>'MARK'},1) if $self->logo_mark;
Branch: 1 branch
BranchTrueFalseTotal
if $self->logo_mark 0 0 0
100 0 ▶ $content .= $self->entag('Banner',$bannercontent,{href=>$self->banner}) if $self->banner;
Branch: 1 branch
BranchTrueFalseTotal
if $self->banner 0 0 0
101 0 ▶ $content .= $self->entag('MoreInfo','',{href=>$self->moreinfo,target=>$self->target},1) if $self->moreinfo;
Branch: 1 branch
BranchTrueFalseTotal
if $self->moreinfo 0 0 0
102 0 $content .= $paramstr;
103  
104 0 $content .= join "", ($self->each_in_queue);
105  
106 0 return $self->entag('ASX',$content,{previewmode => $self->previewmode, version => $self->version, BannerBar => $self->bannerbar},0);
107 }
108  
109 1 1;
110 __END__
↑ Summary ASX/Entry.pm »