line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::RemoteCommand::Pool; |
2
|
1
|
|
|
1
|
|
11
|
use v5.16; |
|
1
|
|
|
|
|
4
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
279
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
sub new { |
6
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
7
|
0
|
|
|
|
|
|
bless { |
8
|
|
|
|
|
|
|
pool => [], |
9
|
|
|
|
|
|
|
}, $class; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub all { |
13
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
14
|
0
|
|
|
|
|
|
@{$self->{pool}}; |
|
0
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub add { |
18
|
0
|
|
|
0
|
0
|
|
my ($self, $ssh) = @_; |
19
|
0
|
|
|
|
|
|
push @{$self->{pool}}, $ssh; |
|
0
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub remove { |
24
|
0
|
|
|
0
|
0
|
|
my ($self, $ssh) = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
for my $i (0..$#{$self->{pool}}) { |
|
0
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
if ($self->{pool}[$i] eq $ssh) { |
28
|
0
|
|
|
|
|
|
return splice @{$self->{pool}}, $i, 1; |
|
0
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
0
|
|
|
|
|
|
return; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub count { |
35
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
36
|
0
|
|
|
|
|
|
scalar @{$self->{pool}}; |
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |