line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BalanceOfPower::Nation::Role::Shareholder; |
2
|
|
|
|
|
|
|
$BalanceOfPower::Nation::Role::Shareholder::VERSION = '0.400110'; |
3
|
13
|
|
|
13
|
|
4155
|
use strict; |
|
13
|
|
|
|
|
13
|
|
|
13
|
|
|
|
|
274
|
|
4
|
13
|
|
|
13
|
|
89
|
use v5.10; |
|
13
|
|
|
|
|
29
|
|
5
|
13
|
|
|
13
|
|
36
|
use Moo::Role; |
|
13
|
|
|
|
|
15
|
|
|
13
|
|
|
|
|
59
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has available_stocks => ( |
8
|
|
|
|
|
|
|
is => 'rw', |
9
|
|
|
|
|
|
|
default => 0 |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub get_stocks |
13
|
|
|
|
|
|
|
{ |
14
|
2
|
|
|
2
|
0
|
3
|
my $self = shift; |
15
|
2
|
|
|
|
|
2
|
my $q = shift; |
16
|
2
|
50
|
|
|
|
5
|
if($q <= $self->available_stocks) |
17
|
|
|
|
|
|
|
{ |
18
|
2
|
|
|
|
|
8
|
$self->available_stocks($self->available_stocks - $q); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
else |
21
|
|
|
|
|
|
|
{ |
22
|
0
|
|
|
|
|
|
return 0; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |