line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BalanceOfPower::Relations::Treaty; |
2
|
|
|
|
|
|
|
$BalanceOfPower::Relations::Treaty::VERSION = '0.400115'; |
3
|
13
|
|
|
13
|
|
60
|
use strict; |
|
13
|
|
|
|
|
18
|
|
|
13
|
|
|
|
|
354
|
|
4
|
13
|
|
|
13
|
|
132
|
use v5.10; |
|
13
|
|
|
|
|
55
|
|
5
|
|
|
|
|
|
|
|
6
|
13
|
|
|
13
|
|
49
|
use Moo; |
|
13
|
|
|
|
|
16
|
|
|
13
|
|
|
|
|
66
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
with 'BalanceOfPower::Relations::Role::Relation'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has type => ( |
11
|
|
|
|
|
|
|
is => 'ro', |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
around 'print' => sub { |
15
|
|
|
|
|
|
|
my $orig = shift; |
16
|
|
|
|
|
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
return $self->short_tag . ": " . |
18
|
|
|
|
|
|
|
$self->$orig(); |
19
|
|
|
|
|
|
|
}; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub short_tag |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
24
|
0
|
0
|
|
|
|
|
if($self->type eq 'alliance') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
25
|
|
|
|
|
|
|
{ |
26
|
0
|
|
|
|
|
|
return 'ALL'; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
elsif($self->type eq 'no aggression') |
29
|
|
|
|
|
|
|
{ |
30
|
0
|
|
|
|
|
|
return 'NAG'; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
elsif($self->type eq 'commercial') |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
|
|
|
return 'COM'; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
else |
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
|
|
|
return '???'; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
sub dump |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
45
|
0
|
|
|
|
|
|
my $io = shift; |
46
|
0
|
|
0
|
|
|
|
my $indent = shift || ""; |
47
|
0
|
|
|
|
|
|
print {$io} $indent . join(";", $self->node1, $self->node2, $self->type) . "\n"; |
|
0
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
sub load |
50
|
|
|
|
|
|
|
{ |
51
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
52
|
0
|
|
|
|
|
|
my $data = shift; |
53
|
0
|
|
|
|
|
|
$data =~ s/^\s+//; |
54
|
0
|
|
|
|
|
|
chomp $data; |
55
|
0
|
|
|
|
|
|
my ($node1, $node2, $type) = split ";", $data; |
56
|
0
|
|
|
|
|
|
return $self->new(node1 => $node1, node2 => $node2, type => $type); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |