lib/BalanceOfPower/Relations/MilitarySupport.pm

filter: Statementstmt 40.0% 12 / 30 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 37.5% 3 / 8 Podpod 0.0% 0 / 5 totaltotal 33.3% 15 / 45 CC 2 SCAR 9.4
CC
2
Cov
38%
casualities
6.0
bidirectional
2.0
print
2.0
CRAP 2.6
« lib/BalanceOfPower/Role/WebMaster.pm ↑ Summary blib/lib/BalanceOfPower.pm »
1 package BalanceOfPower::Relations::MilitarySupport;
2 11 $BalanceOfPower::Relations::MilitarySupport::VERSION = '0.300010';
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 11 with 'BalanceOfPower::Relations::Role::Relation';
9  
10 11 has army => (
11 is => 'rw',
12 default => 0
13 );
14  
15  
16 sub bidirectional
17 {
18 0 ▶ return 0;
Subroutine bidirectional: not called CC=1 SCAR=6.9
Pod undocumented
19 }
20  
21 sub casualities
22 {
23 0 ▶ my $self = shift;
Subroutine casualities: not called CC=2 SCAR=17.9
Pod undocumented
24 0 my $casualities = shift;
25 0 $self->army($self->army - $casualities);
26 0 ▶ $self->army(0) if($self->army < 0);
Branch: 1 branch
BranchTrueFalseTotal
if $self->army < 0 0 0 0
27 }
28  
29 sub print
30 {
31 0 ▶ my $self = shift;
Subroutine print: not called CC=1 SCAR=6.9
Pod undocumented
32 0 return $self->node1 . " --> " . $self->node2 . " [" . $self->army . "]";
33 }
34 sub dump
35 {
36 0 ▶ my $self = shift;
Subroutine dump: not called CC=1 SCAR=6.9
Pod undocumented
37 0 my $io = shift;
38 0 my $indent = shift;
39 0 print {$io} $indent . join(";", $self->node1, $self->node2, $self->army) . "\n";
40 }
41 sub load
42 {
43 0 ▶ my $self = shift;
Subroutine load: not called CC=1 SCAR=6.9
Pod undocumented
44 0 my $data = shift;
45 0 $data =~ s/^\s+//;
46 0 chomp $data;
47 0 my ($node1, $node2, $army) = split ";", $data;
48 0 return $self->new(node1 => $node1, node2 => $node2, army => $army);
49 }
50  
51  
52  
53  
54 11 1;
« lib/BalanceOfPower/Role/WebMaster.pm ↑ Summary blib/lib/BalanceOfPower.pm »