lib/BalanceOfPower/Relations/MilitarySupport.pm

filter: Statementstmt 63.3% 19 / 30 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 5 totaltotal 57.7% 26 / 45 CC 2 SCAR 3.7
CC
2
Cov
62%
casualities
2.0
dump
2.0
load
2.0
CRAP 1.4
« lib/BalanceOfPower/Commands/BoostProduction.pm ↑ Summary lib/BalanceOfPower/Nation/Role/Shareholder.pm »
1 package BalanceOfPower::Relations::MilitarySupport;
2 11 $BalanceOfPower::Relations::MilitarySupport::VERSION = '0.200000';
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 119 ▶ return 0;
Subroutine bidirectional: called CC=1 SCAR=0.0
Pod undocumented
19 }
20  
21 sub casualities
22 {
23 2 ▶ my $self = shift;
Subroutine casualities: called CC=2 SCAR=7.0
Pod undocumented
24 2 my $casualities = shift;
25 2 $self->army($self->army - $casualities);
26 2 ▶ $self->army(0) if($self->army < 0);
Branch: 1 branch
BranchTrueFalseTotal
if $self->army < 0 0 2 2
27 }
28  
29 sub print
30 {
31 1 ▶ my $self = shift;
Subroutine print: called CC=1 SCAR=0.0
Pod undocumented
32 1 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/Commands/BoostProduction.pm ↑ Summary lib/BalanceOfPower/Nation/Role/Shareholder.pm »