blib/lib/Perl/Dist/Inno/System.pm

filter: Statementstmt 86.8% 33 / 38 Branchbran 50.0% 12 / 24 Conditioncond 33.3% 4 / 12 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 91.6% 11 / 12 Podpod 0.0% 0 / 4 totaltotal 61.2% 60 / 98 CC 17 SCAR 24.6
CC
17
Cov
66%
new
20.1
as_string
15.0
uninstallrun
2.0
CRAP 11.7
« blib/lib/auto/share/dist/Perl-Dist/vanilla/perl-5.10.0/lib/Config.pm ↑ Summary blib/lib/Perl/Dist/Asset.pm »
1 package Perl::Dist::Inno::System;
2  
3 # Object that represents [Run] or [UninstallRun] system call entries.
4  
5 2 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use Carp qw{ croak };
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Params::Util qw{ _IDENTIFIER _STRING };
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 ▶use vars qw{$VERSION};
Subroutine BEGIN: called CC=1 SCAR=0.0
12 2 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 $VERSION = '1.16';
14 }
15  
16 2 ▶use Object::Tiny qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
17 section
18 filename
19 description
20 parameters
21 working_dir
22 status_msg
23 run_once_id
24 verbs
25 flags
26 2 };
27  
28  
29  
30  
31  
32 #####################################################################
33 # Constructors
34  
35 1 ▶sub new {
Subroutine new: called CC=9 SCAR=30.0
Pod undocumented
36 1 my $class = shift;
37  
38 # Create the object
39 1 my $self = bless { @_ }, $class;
40  
41 # Check params
42 1 ▶ unless (
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->section and $self->section =~ /^(?:Run|UninstallRun)$/) 0 1 1
Condition33%1/3
defined $self->section and $self->section =~ /^(?:Run|UninstallRun)$/
!ll&&!rl&&r
001
MC/DC0%0/2
defined $self->section and $self->section =~ /^(?:Run|UninstallRun)$/
defined $self->section $self->section =~ /^(?:Run|UninstallRun)$/
Truth table33%1/3
A and B
A= defined $self->sectionB= $self->section =~ /^(?:Run|UninstallRun)$/
ABresult
0X0
100
111
43 defined $self->section
44 and
45 $self->section =~ /^(?:Run|UninstallRun)$/
46 ) {
47 0 croak("Missing or invalid 'section' param");
48 }
49 1 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->description and $self->section eq "Run") 0 1 1
Condition33%1/3
defined $self->description and $self->section eq "Run"
!ll&&!rl&&r
100
MC/DC0%0/2
defined $self->description and $self->section eq "Run"
defined $self->description $self->section eq "Run"
Truth table33%1/3
A and B
A= defined $self->descriptionB= $self->section eq "Run"
ABresult
0X0
100
111
50 defined $self->description
51 and
52 $self->section eq 'Run'
53 ) {
54 0 croak("A Description is only valid in a [Run] block");
55 }
56 1 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->status_msg and $self->section eq "Run") 0 1 1
Condition33%1/3
defined $self->status_msg and $self->section eq "Run"
!ll&&!rl&&r
100
MC/DC0%0/2
defined $self->status_msg and $self->section eq "Run"
defined $self->status_msg $self->section eq "Run"
Truth table33%1/3
A and B
A= defined $self->status_msgB= $self->section eq "Run"
ABresult
0X0
100
111
57 defined $self->status_msg
58 and
59 $self->section eq 'Run'
60 ) {
61 0 croak("A StatusMsg is only valid in a [Run] block");
62 }
63 1 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->run_once_id and $self->section eq "UninstallRun") 0 1 1
Condition33%1/3
defined $self->run_once_id and $self->section eq "UninstallRun"
!ll&&!rl&&r
100
MC/DC0%0/2
defined $self->run_once_id and $self->section eq "UninstallRun"
defined $self->run_once_id $self->section eq "UninstallRun"
Truth table33%1/3
A and B
A= defined $self->run_once_idB= $self->section eq "UninstallRun"
ABresult
0X0
100
111
64 defined $self->run_once_id
65 and
66 $self->section eq 'UninstallRun'
67 ) {
68 0 croak("A RunOnceId is only valid in an [UninstallRun] block");
69 }
70  
71 1 return $self;
72 }
73  
74 1 ▶sub run {
Subroutine run: called CC=1 SCAR=0.0
Pod undocumented
75 shift->new(
76 1 section => 'Run',
77 @_,
78 );
79 }
80  
81 0 ▶sub uninstallrun {
Subroutine uninstallrun: not called CC=1 SCAR=6.9
Pod undocumented
82 shift->new(
83 0 section => 'UninstallRun',
84 @_,
85 );
86 }
87  
88  
89  
90  
91  
92 #####################################################################
93 # Main Methods
94  
95 1 ▶sub as_string {
Subroutine as_string: called CC=9 SCAR=27.1
Pod undocumented
96 1 my $self = shift;
97 1 my @flags = ();
98 # push @flags, 'flag_name' if $self->flag_name;
99 1 ▶ return join( '; ',
Branch: 8 branches
BranchTrueFalseTotal
defined $self->filename ? : 1 0 1
defined $self->description ? : 0 1 1
defined $self->parameters ? : 0 1 1
defined $self->working_dir ? : 1 0 1
defined $self->status_msg ? : 0 1 1
defined $self->run_once_id ? : 0 1 1
defined $self->verbs ? : 0 1 1
scalar @flags ? : 0 1 1
100 (defined $self->filename)
101 ? ("Filename: \"" . $self->filename . "\"")
102 : (),
103 (defined $self->description)
104 ? ("Description: \"" . $self->description . "\"")
105 : (),
106 (defined $self->parameters)
107 ? ("Parameters: \"" . $self->parameters . "\"")
108 : (),
109 (defined $self->working_dir)
110 ? ("WorkingDir: \"" . $self->working_dir . "\"")
111 : (),
112 (defined $self->status_msg)
113 ? ("StatusMsg: \"" . $self->status_msg . "\"")
114 : (),
115 (defined $self->run_once_id)
116 ? ("RunOnceId: \"" . $self->run_once_id . "\"")
117 : (),
118 (defined $self->verbs)
119 ? ("Verbs: \"" . $self->verbs . "\"")
120 : (),
121 (scalar @flags)
122 ? ("Flags: " . join(' ', @flags))
123 : (),
124 );
125 }
126  
127 2 1;
« blib/lib/auto/share/dist/Perl-Dist/vanilla/perl-5.10.0/lib/Config.pm ↑ Summary blib/lib/Perl/Dist/Asset.pm »