| 1 | package Analizo::Model; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 45 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 45 | ▶ | use Graph; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 45 | ▶ | use File::Basename; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 184 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 184 | my @defaults = ( | |||||||||||||||||||||||||||||||||||||||||
| 8 | members => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 9 | modules => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 10 | files => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 11 | module_by_file => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 12 | calls => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 13 | lines => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 14 | protection => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 15 | inheritance => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 16 | parameters => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 17 | conditional_paths => {}, | ||||||||||||||||||||||||||||||||||||||||||
| 18 | abstract_classes => [], | ||||||||||||||||||||||||||||||||||||||||||
| 19 | module_names => [], | ||||||||||||||||||||||||||||||||||||||||||
| 20 | modules_graph => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 21 | files_graph => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 184 | return bless { @defaults }, __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 5 | ▶ | sub modules { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modules: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 5 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 5 | return $self->{modules}; | |||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 22 | ▶ | sub module_names { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_names: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 22 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 22 | return @{$self->{module_names}}; | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 148 | ▶ | sub declare_module { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_module: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 148 | my ($self, $module, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 38 | 148 | ▶ | if (! grep { $_ eq $module} @{$self->{module_names}}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 143 | push @{$self->{module_names}}, $module; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 148 | ▶ | if (defined($file)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | #undup filename | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 127 | foreach (@{$self->{files}->{$module}}) { | |||||||||||||||||||||||||||||||||||||||||
| 44 | 5 | ▶ | return if($_ eq $file); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 125 | ▶ | $self->{files}->{$module} ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"files"}{$module} ||= []
MC/DC0%0/1
$self->{"files"}{$module} ||= []
$self->{"files"}{$module}
Truth table50%1/2
A
A= $self->{"files"}{$module}
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 125 | push(@{$self->{files}->{$module}}, $file); | |||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 125 | ▶ | $self->{module_by_file}->{$file} ||= []; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"module_by_file"}{$file} ||= []
MC/DC100%1/1
$self->{"module_by_file"}{$file} ||= []
$self->{"module_by_file"}{$file}
Truth table100%2/2
A
A= $self->{"module_by_file"}{$file}
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 125 | push @{$self->{module_by_file}->{$file}}, $module; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 122 | ▶ | sub files { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
files: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 56 | 122 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 57 | 122 | return $self->{files}->{$module}; | |||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 2 | ▶ | sub module_by_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_by_file: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 2 | my ($self, $file) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 62 | 2 | ▶ | return @{$self->{module_by_file}->{$file} || []}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'module_by_file'}{$file} || []
MC/DC0%0/1
$self->{'module_by_file'}{$file} || []
$self->{'module_by_file'}{$file}
Truth table50%1/2
A
A= $self->{'module_by_file'}{$file}
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | 112 | ▶ | sub inheritance { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inheritance: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 112 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 67 | 112 | my $list = $self->{inheritance}->{$module}; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 112 | ▶ | return $list ? @$list : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 37 | ▶ | sub add_inheritance { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_inheritance: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 37 | my ($self, $child, $parent) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 73 | 37 | ▶ | $self->{inheritance}->{$child} = [] if !exists($self->{inheritance}->{$child}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 37 | push @{$self->{inheritance}->{$child}}, $parent; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 332 | ▶ | sub members { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
members: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 332 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 332 | return $self->{members}; | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | 186 | ▶ | sub declare_member { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_member: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 83 | 186 | my ($self, $module, $member, $type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | # mapping member to module | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 186 | $self->{members}->{$member} = $module; | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my ($self, $member) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | return $self->{types}->{$member}; | |||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 147 | ▶ | sub declare_function { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_function: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 147 | my ($self, $module, $function) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 147 | ▶ | return unless $module; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 147 | $self->declare_member($module, $function, 'function'); | |||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 147 | ▶ | if (!exists($self->{modules}->{$module})){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 90 | $self->{modules}->{$module} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 90 | $self->{modules}->{$module}->{functions} = []; | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 147 | ▶ | if(! grep { $_ eq $function } @{$self->{modules}->{$module}->{functions}}){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 144 | push @{$self->{modules}->{$module}->{functions}}, $function; | |||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 39 | ▶ | sub declare_variable { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
declare_variable: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 109 | 39 | my ($self, $module, $variable) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 110 | 39 | $self->declare_member($module, $variable, 'variable'); | |||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | 39 | ▶ | if (!exists($self->{modules}->{$module})){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 113 | 5 | $self->{modules}->{$module} = {}; | |||||||||||||||||||||||||||||||||||||||||
| 114 | 5 | $self->{modules}->{$module}->{variables} = []; | |||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 39 | ▶ | if(! grep { $_ eq $variable } @{$self->{modules}->{$module}->{variables}}){ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 39 | push @{$self->{modules}->{$module}->{variables}}, $variable; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 78 | ▶ | sub add_call { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_call: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 78 | my ($self, $caller, $callee, $reftype) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 78 | ▶ | $reftype ||= 'direct'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$reftype ||= "direct"
MC/DC100%1/1
$reftype ||= "direct"
$reftype
Truth table100%2/2
A
A= $reftype
| |||||||||||||||||||||||||||||||||||||||||||
| 124 | 78 | ▶ | $self->{calls}->{$caller} = {} if !exists($self->{calls}->{$caller}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 78 | $self->{calls}->{$caller}->{$callee} = $reftype; | |||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 168 | ▶ | sub calls { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
calls: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 168 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 168 | return $self->{calls}; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 69 | ▶ | sub abstract_classes { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
abstract_classes: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 69 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 135 | 69 | my $list = $self->{abstract_classes}; | |||||||||||||||||||||||||||||||||||||||||
| 136 | 69 | ▶ | return $list ? @$list : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||
| 139 | 7 | ▶ | sub add_abstract_class { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_abstract_class: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 140 | 7 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 141 | 7 | push @{$self->{abstract_classes}},$module; | |||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 18 | ▶ | sub add_variable_use { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_variable_use: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 18 | add_call(@_, 'variable'); | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 11 | ▶ | sub add_loc { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_loc: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 11 | my ($self, $function, $lines) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 150 | 11 | $self->{lines}->{$function} = $lines; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 5 | ▶ | sub add_conditional_paths { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_conditional_paths: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 5 | my ($self, $function, $conditional_paths) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 5 | $self->{conditional_paths}->{$function} = $conditional_paths; | |||||||||||||||||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | 9 | ▶ | sub add_protection { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_protection: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 9 | my ($self, $member, $protection) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 9 | ▶ | $self->{protection}->{$member} = $protection if $member; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | 2 | ▶ | sub add_parameters { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_parameters: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 2 | my ($self, $function, $parameters) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 165 | 2 | $self->{parameters}->{$function} = $parameters; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 119 | ▶ | sub functions { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
functions: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 119 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 119 | my $list = $self->{modules}->{$module}->{functions}; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 119 | ▶ | return $list ? @$list : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 40 | ▶ | sub variables { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
variables: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 40 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 176 | 40 | my $list = $self->{modules}->{$module}->{variables}; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 40 | ▶ | return $list ? @$list : (); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | |||||||||||||||||||||||||||||||||||||||||||
| 180 | 4 | ▶ | sub all_members { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
all_members: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 4 | my ($self, $module) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 4 | my @functions = $self->functions($module); | |||||||||||||||||||||||||||||||||||||||||
| 183 | 4 | my @variables = $self->variables($module); | |||||||||||||||||||||||||||||||||||||||||
| 184 | 4 | return @functions, @variables; | |||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | 142 | ▶ | sub _group_files { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_group_files: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 142 | my @files = @_; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 142 | (my $file = $files[0]) =~ s/\.[^.]+$//; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 142 | $file; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | 38 | ▶ | sub modules_graph { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
modules_graph: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | 38 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 195 | 38 | ▶ | $self->build_graphs unless $self->{modules_graph}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | 38 | return $self->{modules_graph}; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 37 | ▶ | sub files_graph { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
files_graph: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 37 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 201 | 37 | ▶ | $self->build_graphs unless $self->{files_graph}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 37 | return $self->{files_graph}; | |||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 47 | ▶ | sub build_graphs { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_graphs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 47 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||
| 208 | 47 | $self->{modules_graph} = Graph->new; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 47 | $self->{files_graph} = Graph->new; | |||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 47 | $self->{modules_graph}->set_graph_attribute('name', 'graph'); | |||||||||||||||||||||||||||||||||||||||||
| 212 | 47 | $self->{files_graph}->set_graph_attribute('name', 'graph'); | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 47 | $self->_add_all_vertex_on_each_graph; | |||||||||||||||||||||||||||||||||||||||||
| 215 | 47 | $self->_add_all_references_between_files_and_modules_as_edges_on_each_graph; | |||||||||||||||||||||||||||||||||||||||||
| 216 | 47 | $self->_add_all_references_from_inheritance_as_edges_on_each_graph; | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 47 | ▶ | sub _add_all_vertex_on_each_graph{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_all_vertex_on_each_graph: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 47 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 47 | foreach my $module (keys %{ $self->{files}}) { | |||||||||||||||||||||||||||||||||||||||||
| 223 | # Modules Graph | ||||||||||||||||||||||||||||||||||||||||||
| 224 | 67 | $self->{modules_graph}->add_vertex($module); | |||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | # Files Graph | ||||||||||||||||||||||||||||||||||||||||||
| 227 | 67 | my $file = $self->files($module); | |||||||||||||||||||||||||||||||||||||||||
| 228 | 67 | my $file_without_extension = _group_files(@{ $file }); | |||||||||||||||||||||||||||||||||||||||||
| 229 | 67 | $self->{files_graph}->add_vertex($file_without_extension); | |||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 47 | ▶ | sub _add_all_references_between_files_and_modules_as_edges_on_each_graph{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_all_references_between_files_and_modules_as_edges_on_each_graph: called CC=13 SCAR=26.0
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 47 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 47 | foreach my $current_function_call (keys %{$self->calls}) { | |||||||||||||||||||||||||||||||||||||||||
| 237 | # Modules Graph | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 24 | my $calling_module = $self->_function_to_module($current_function_call); | |||||||||||||||||||||||||||||||||||||||||
| 239 | # Files Graph | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 24 | my $calling_file = $self->_function_to_file($current_function_call); | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 24 | ▶ | next unless $calling_file || $calling_module; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$calling_file or $calling_module
MC/DC0%0/2
$calling_file or $calling_module
$calling_file
$calling_module
Truth table66%2/3
A or B
A= $calling_fileB= $calling_module
| |||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 24 | ▶ | if ($calling_module) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 24 | $self->{modules_graph}->add_vertex($calling_module); | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 24 | ▶ | if ($calling_file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 13 | $calling_file = _group_files(@{$calling_file}); | |||||||||||||||||||||||||||||||||||||||||
| 249 | 13 | $self->{files_graph}->add_vertex($calling_file); | |||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 24 | foreach my $call_inside_current_function (keys %{$self->calls->{$current_function_call}}) { | |||||||||||||||||||||||||||||||||||||||||
| 253 | # Modules Graph | ||||||||||||||||||||||||||||||||||||||||||
| 254 | 33 | my $called_module = $self->_function_to_module($call_inside_current_function); | |||||||||||||||||||||||||||||||||||||||||
| 255 | # Files Graph | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 33 | my $called_file = $self->_function_to_file($call_inside_current_function); | |||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | 33 | ▶ | next unless $called_module || $called_file; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$called_module or $called_file
MC/DC0%0/2
$called_module or $called_file
$called_module
$called_file
Truth table33%1/3
A or B
A= $called_moduleB= $called_file
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | # Modules Graph | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 33 | ▶ | if ($called_module) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | 33 | $self->{modules_graph}->add_vertex($called_module); | |||||||||||||||||||||||||||||||||||||||||
| 263 | 33 | ▶ | unless ($calling_module eq $called_module) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 25 | $self->{modules_graph}->add_edge($calling_module, $called_module); | |||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | # Files Graph | ||||||||||||||||||||||||||||||||||||||||||
| 269 | 33 | ▶ | if ($called_file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 21 | $called_file = _group_files(@{$called_file}); | |||||||||||||||||||||||||||||||||||||||||
| 271 | 21 | $self->{files_graph}->add_vertex($called_file); | |||||||||||||||||||||||||||||||||||||||||
| 272 | 21 | ▶ | unless ($calling_file eq $called_file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 19 | $self->{files_graph}->add_edge($calling_file, $called_file); | |||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | 47 | ▶ | sub _add_all_references_from_inheritance_as_edges_on_each_graph { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_all_references_from_inheritance_as_edges_on_each_graph: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 281 | 47 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 47 | foreach my $subclass (keys(%{$self->{inheritance}})) { | |||||||||||||||||||||||||||||||||||||||||
| 283 | # Modules Graph | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 17 | $self->{modules_graph}->add_vertex($subclass); | |||||||||||||||||||||||||||||||||||||||||
| 285 | # Files Graph | ||||||||||||||||||||||||||||||||||||||||||
| 286 | 17 | my $subclass_file = $self->files($subclass); | |||||||||||||||||||||||||||||||||||||||||
| 287 | 17 | ▶ | if ($subclass_file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 288 | 17 | $subclass_file = _group_files(@{$subclass_file}); | |||||||||||||||||||||||||||||||||||||||||
| 289 | 17 | $self->{files_graph}->add_vertex($subclass_file); | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | 17 | foreach my $superclass ($self->inheritance($subclass)) { | |||||||||||||||||||||||||||||||||||||||||
| 292 | 18 | $self->_find_recursively_references_from_deep_inheritance($subclass, $subclass_file, $superclass); | |||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | } | ||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 24 | ▶ | sub _find_recursively_references_from_deep_inheritance { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_find_recursively_references_from_deep_inheritance: called CC=4 SCAR=14.2
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 24 | my ($self, $subclass, $subclass_file, $superclass) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | # Modules Graph | ||||||||||||||||||||||||||||||||||||||||||
| 301 | 24 | $self->{modules_graph}->add_edge($subclass, $superclass); | |||||||||||||||||||||||||||||||||||||||||
| 302 | # Files Graph | ||||||||||||||||||||||||||||||||||||||||||
| 303 | 24 | my $superclass_file = $self->files($superclass); | |||||||||||||||||||||||||||||||||||||||||
| 304 | 24 | ▶ | if ($superclass_file && $subclass_file) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$superclass_file and $subclass_file
MC/DC0%0/2
$superclass_file and $subclass_file
$superclass_file
$subclass_file
Truth table33%1/3
A and B
A= $superclass_fileB= $subclass_file
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 24 | $superclass_file = _group_files(@{$superclass_file}); | |||||||||||||||||||||||||||||||||||||||||
| 306 | 24 | $self->{files_graph}->add_edge($subclass_file, $superclass_file); | |||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 24 | foreach my $super_uper_class ($self->inheritance($superclass)) { | |||||||||||||||||||||||||||||||||||||||||
| 310 | 6 | $self->_find_recursively_references_from_deep_inheritance($subclass, $subclass_file, $super_uper_class); | |||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | 57 | ▶ | sub _function_to_file { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_function_to_file: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | 57 | my ($self, $function) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 316 | 57 | ▶ | return unless exists $self->members->{$function}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 317 | 57 | my $module = $self->members->{$function}; | |||||||||||||||||||||||||||||||||||||||||
| 318 | 57 | $self->{files}->{$module}; | |||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 10 | ▶ | sub _add_dependency { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add_dependency: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 10 | my ($dependencies, $from, $to) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 323 | 10 | ▶ | $dependencies->{$from} = { } if !exists($dependencies->{$from}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 324 | 10 | ▶ | if (exists $dependencies->{$from}->{$to}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 3 | $dependencies->{$from}->{$to} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 326 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 327 | 7 | $dependencies->{$from}->{$to} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||||||||||||
| 331 | 7 | ▶ | sub _reftype_to_style { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_reftype_to_style: called CC=3 SCAR=11.4
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 7 | my ($reftype) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 333 | 7 | ▶ | $reftype = $reftype || 'direct'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$reftype || 'direct'
MC/DC0%0/1
$reftype || 'direct'
$reftype
Truth table50%1/2
A
A= $reftype
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | 7 | my %styles = ( | |||||||||||||||||||||||||||||||||||||||||
| 335 | 'direct' => 'solid', | ||||||||||||||||||||||||||||||||||||||||||
| 336 | 'indirect' => 'dotted', | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 'variable' => 'dashed', | ||||||||||||||||||||||||||||||||||||||||||
| 338 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 339 | 7 | ▶ | return $styles{$reftype} || 'solid'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$styles{$reftype} || 'solid'
MC/DC0%0/1
$styles{$reftype} || 'solid'
$styles{$reftype}
Truth table50%1/2
A
A= $styles{$reftype}
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||
| 342 | 12 | ▶ | sub callgraph { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
callgraph: called CC=13 SCAR=26.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 343 | 12 | my ($self, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 344 | 12 | my $graph = Graph->new; | |||||||||||||||||||||||||||||||||||||||||
| 345 | 12 | $graph->set_graph_attribute('name', 'callgraph'); | |||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 12 | ▶ | if ($args{group_by_module}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 348 | # listing dependencies grouped by module | ||||||||||||||||||||||||||||||||||||||||||
| 349 | 4 | my $modules_dependencies = { }; | |||||||||||||||||||||||||||||||||||||||||
| 350 | 4 | foreach my $caller (sort(keys %{$self->calls})) { | |||||||||||||||||||||||||||||||||||||||||
| 351 | 5 | foreach my $callee (sort(keys %{$self->calls->{$caller}})) { | |||||||||||||||||||||||||||||||||||||||||
| 352 | 10 | my $calling_module = $self->_function_to_module($caller); | |||||||||||||||||||||||||||||||||||||||||
| 353 | 10 | my $called_module = $self->_function_to_module($callee); | |||||||||||||||||||||||||||||||||||||||||
| 354 | 10 | ▶ | next unless (defined($calling_module) && defined($called_module) && ($calling_module ne $called_module)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $calling_module and defined $called_module and $calling_module ne $called_module
defined $calling_module and defined $called_module
MC/DC0%0/3
defined $calling_module and defined $called_module and $calling_module ne $called_module
defined $calling_module
defined $called_module
$calling_module ne $called_module
Truth table25%1/4
A and B and C
A= defined $calling_moduleB= defined $called_moduleC= $calling_module ne $called_module
| |||||||||||||||||||||||||||||||||||||||||||
| 355 | 10 | _add_dependency($modules_dependencies, $calling_module, $called_module); | |||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | 4 | foreach my $subclass (sort(keys(%{$self->{inheritance}}))) { | |||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | foreach my $superclass ($self->inheritance($subclass)) { | |||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | _add_dependency($modules_dependencies, $subclass, $superclass); | |||||||||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||||||||
| 362 | } | ||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 4 | foreach my $calling_module (sort(keys %{$modules_dependencies})) { | |||||||||||||||||||||||||||||||||||||||||
| 365 | 5 | foreach my $called_module (sort(keys %{$modules_dependencies->{$calling_module}})) { | |||||||||||||||||||||||||||||||||||||||||
| 366 | 7 | my $strength = $modules_dependencies->{$calling_module}->{$called_module}; | |||||||||||||||||||||||||||||||||||||||||
| 367 | 7 | $graph->add_edge($calling_module, $called_module); | |||||||||||||||||||||||||||||||||||||||||
| 368 | 7 | $graph->set_edge_attribute($calling_module, $called_module, 'style', 'solid'); | |||||||||||||||||||||||||||||||||||||||||
| 369 | 7 | $graph->set_edge_attribute($calling_module, $called_module, 'label', $strength); | |||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||||||||
| 373 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 374 | # listing raw dependency info | ||||||||||||||||||||||||||||||||||||||||||
| 375 | 8 | foreach my $caller (grep { $self->_include_caller($_, @{$args{omit}}) } sort(keys(%{$self->calls}))) { | |||||||||||||||||||||||||||||||||||||||||
| 376 | 7 | foreach my $callee (grep { $self->_include_callee($_, $args{include_externals}, @{$args{omit}}) } sort(keys(%{$self->calls->{$caller}}))) { | |||||||||||||||||||||||||||||||||||||||||
| 377 | 7 | my $style = _reftype_to_style($self->calls->{$caller}->{$callee}); | |||||||||||||||||||||||||||||||||||||||||
| 378 | 7 | $graph->add_edge($caller, $callee); | |||||||||||||||||||||||||||||||||||||||||
| 379 | 7 | $graph->set_edge_attribute($caller, $callee, 'style', $style); | |||||||||||||||||||||||||||||||||||||||||
| 380 | 7 | $graph->set_vertex_attribute($caller, 'group', $self->_function_to_module($caller)); | |||||||||||||||||||||||||||||||||||||||||
| 381 | 7 | $graph->set_vertex_attribute($callee, 'group', $self->_function_to_module($callee)); | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | 12 | return $graph; | |||||||||||||||||||||||||||||||||||||||||
| 386 | } | ||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | 88 | ▶ | sub _file_to_module { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_file_to_module: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 389 | 88 | my ($filename) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 390 | 88 | $filename =~ s/\.r\d+\.expand$//; | |||||||||||||||||||||||||||||||||||||||||
| 391 | 88 | return basename($filename); | |||||||||||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||||||||||||
| 394 | 91 | ▶ | sub _function_to_module { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_function_to_module: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 395 | 91 | my ($self, $function) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 396 | 91 | ▶ | return undef if !exists($self->members->{$function}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 88 | return _file_to_module($self->members->{$function}); | |||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 17 | ▶ | sub _include_caller { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_include_caller: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 17 | my ($self, $function, @omitted) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 402 | 17 | return !grep { $function eq $_ } @omitted; | |||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 9 | ▶ | sub _include_callee { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_include_callee: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | 9 | my ($self, $member, $include_externals, @omitted) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 407 | 9 | ▶ | return $self->_include_caller($member, @omitted) && ( exists($self->members->{$member}) || $include_externals ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%6/6
$self->_include_caller($member, @omitted) && (exists $self->members->{$member} || $include_externals)
exists $self->members->{$member} or $include_externals
MC/DC100%3/3
$self->_include_caller($member, @omitted) && (exists $self->members->{$member} || $include_externals)
$self->_include_caller($member, @omitted)
exists $self->members->{$member}
$include_externals
Truth table100%4/4
A && B or C
A= $self->_include_caller($member, @omitted)B= exists $self->members->{$member}C= $include_externals
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | 45 | 1; | |||||||||||||||||||||||||||||||||||||||||