line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FusionInventory::Agent::Task::Inventory::HPUX::Softwares; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
93639004
|
use strict; |
|
2
|
|
|
|
|
20
|
|
|
2
|
|
|
|
|
136
|
|
4
|
2
|
|
|
2
|
|
23
|
use warnings; |
|
2
|
|
|
|
|
23
|
|
|
2
|
|
|
|
|
150
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
1160
|
use FusionInventory::Agent::Tools; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
985
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub isEnabled { |
9
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
return |
12
|
|
|
|
|
|
|
!$params{no_category}->{software} && |
13
|
0
|
|
0
|
|
|
0
|
canRun('swlist'); |
14
|
|
|
|
|
|
|
} |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub doInventory { |
17
|
0
|
|
|
0
|
0
|
0
|
my (%params) = @_; |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
0
|
my $inventory = $params{inventory}; |
20
|
0
|
|
|
|
|
0
|
my $logger = $params{logger}; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
my $list = _getSoftwaresList( |
23
|
|
|
|
|
|
|
command => 'swlist', |
24
|
|
|
|
|
|
|
logger => $logger |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
0
|
return unless $list; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
foreach my $software (@$list) { |
30
|
0
|
|
|
|
|
0
|
$inventory->addEntry( |
31
|
|
|
|
|
|
|
section => 'SOFTWARES', |
32
|
|
|
|
|
|
|
entry => $software |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _getSoftwaresList { |
38
|
2
|
|
|
2
|
|
345
|
my $handle = getFileHandle(@_); |
39
|
2
|
50
|
|
|
|
7
|
return unless $handle; |
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
4
|
my @softwares; |
42
|
2
|
|
|
|
|
37
|
while (my $line = <$handle>) { |
43
|
227
|
|
|
|
|
254
|
chomp $line; |
44
|
227
|
100
|
|
|
|
821
|
next unless $line =~ /^ |
45
|
|
|
|
|
|
|
\s\s # two spaces |
46
|
|
|
|
|
|
|
(\S+) # name |
47
|
|
|
|
|
|
|
\s+ |
48
|
|
|
|
|
|
|
(\S+) # version |
49
|
|
|
|
|
|
|
\s+ |
50
|
|
|
|
|
|
|
(\S.*\S) # comment |
51
|
|
|
|
|
|
|
/x; |
52
|
199
|
100
|
|
|
|
647
|
next if $1 =~ /^PH/; |
53
|
166
|
|
|
|
|
1226
|
push @softwares, { |
54
|
|
|
|
|
|
|
NAME => $1, |
55
|
|
|
|
|
|
|
VERSION => $2, |
56
|
|
|
|
|
|
|
COMMENTS => $3, |
57
|
|
|
|
|
|
|
PUBLISHER => 'HP' |
58
|
|
|
|
|
|
|
}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
2
|
|
|
|
|
59
|
close $handle; |
62
|
|
|
|
|
|
|
|
63
|
2
|
|
|
|
|
11
|
return \@softwares; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |