line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task; |
2
|
|
|
|
|
|
|
|
3
|
36
|
|
|
36
|
|
1988836
|
use strict; |
|
36
|
|
|
|
|
62
|
|
|
36
|
|
|
|
|
1079
|
|
4
|
36
|
|
|
36
|
|
192
|
use warnings; |
|
36
|
|
|
|
|
66
|
|
|
36
|
|
|
|
|
1168
|
|
5
|
|
|
|
|
|
|
|
6
|
36
|
|
|
36
|
|
1110
|
use English qw(-no_match_vars); |
|
36
|
|
|
|
|
4612
|
|
|
36
|
|
|
|
|
360
|
|
7
|
36
|
|
|
36
|
|
20574
|
use File::Find; |
|
36
|
|
|
|
|
366
|
|
|
36
|
|
|
|
|
2893
|
|
8
|
|
|
|
|
|
|
|
9
|
36
|
|
|
36
|
|
11318
|
use FusionInventory::Agent::Tools; |
|
36
|
|
|
|
|
84
|
|
|
36
|
|
|
|
|
6675
|
|
10
|
36
|
|
|
36
|
|
6698
|
use FusionInventory::Agent::Logger; |
|
36
|
|
|
|
|
93
|
|
|
36
|
|
|
|
|
15015
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
13
|
4
|
|
|
4
|
1
|
1397
|
my ($class, %params) = @_; |
14
|
|
|
|
|
|
|
|
15
|
4
|
100
|
|
|
|
29
|
die 'no target parameter' unless $params{target}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my $self = { |
18
|
|
|
|
|
|
|
logger => $params{logger} || |
19
|
|
|
|
|
|
|
FusionInventory::Agent::Logger->new(), |
20
|
|
|
|
|
|
|
config => $params{config}, |
21
|
|
|
|
|
|
|
confdir => $params{confdir}, |
22
|
|
|
|
|
|
|
datadir => $params{datadir}, |
23
|
|
|
|
|
|
|
target => $params{target}, |
24
|
|
|
|
|
|
|
deviceid => $params{deviceid}, |
25
|
3
|
|
66
|
|
|
34
|
}; |
26
|
3
|
|
|
|
|
8
|
bless $self, $class; |
27
|
|
|
|
|
|
|
|
28
|
3
|
|
|
|
|
18
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub abort { |
32
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
33
|
0
|
|
|
|
|
0
|
$self->{logger}->info("aborting task"); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub getModules { |
37
|
1
|
|
|
1
|
1
|
333
|
my ($class, $prefix) = @_; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# allow to be called as an instance method |
40
|
1
|
50
|
|
|
|
4
|
$class = ref $class ? ref $class : $class; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# use %INC to retrieve the root directory for this task |
43
|
1
|
|
|
|
|
6
|
my $file = module2file($class); |
44
|
1
|
|
|
|
|
4
|
my $rootdir = $INC{$file}; |
45
|
1
|
|
|
|
|
4
|
$rootdir =~ s/.pm$//; |
46
|
1
|
50
|
|
|
|
34
|
return unless -d $rootdir; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# find a list of modules from files in this directory |
49
|
1
|
|
|
|
|
2
|
my $root = $file; |
50
|
1
|
|
|
|
|
5
|
$root =~ s/.pm$//; |
51
|
1
|
50
|
|
|
|
3
|
$root .= "/$prefix" if $prefix; |
52
|
1
|
|
|
|
|
2
|
my @modules; |
53
|
|
|
|
|
|
|
my $wanted = sub { |
54
|
197
|
100
|
|
197
|
|
3422
|
return unless -f $_; |
55
|
172
|
50
|
|
|
|
975
|
return unless $File::Find::name =~ m{($root/\S+\.pm)$}; |
56
|
172
|
|
|
|
|
436
|
my $module = file2module($1); |
57
|
172
|
|
|
|
|
2126
|
push(@modules, $module); |
58
|
1
|
|
|
|
|
5
|
}; |
59
|
1
|
|
|
|
|
105
|
File::Find::find($wanted, $rootdir); |
60
|
|
|
|
|
|
|
return @modules |
61
|
1
|
|
|
|
|
47
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
1; |
64
|
|
|
|
|
|
|
__END__ |