File Coverage

blib/lib/FusionInventory/Agent/Task/Inventory/Generic/Softwares/Pacman.pm
Criterion Covered Total %
statement 9 21 42.8
branch 0 4 0.0
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 12 32 37.5


line stmt bran cond sub pod time code
1             package FusionInventory::Agent::Task::Inventory::Generic::Softwares::Pacman;
2              
3 1     1   156668063 use strict;
  1         4  
  1         106  
4 1     1   13 use warnings;
  1         3  
  1         114  
5              
6 1     1   1159 use FusionInventory::Agent::Tools;
  1         3  
  1         437  
7              
8             sub isEnabled {
9 0     0 0   return canRun('pacman');
10             }
11              
12             sub doInventory {
13 0     0 0   my (%params) = @_;
14              
15 0           my $inventory = $params{inventory};
16 0           my $logger = $params{logger};
17              
18 0           my $handle = getFileHandle(
19             logger => $logger,
20             command => 'pacman -Q'
21             );
22 0 0         return unless $handle;
23              
24 0           while (my $line = <$handle>) {
25 0 0         next unless $line =~ /^(\S+)\s+(\S+)/;
26 0           my $name = $1;
27 0           my $version = $2;
28              
29 0           $inventory->addEntry(
30             section => 'SOFTWARES',
31             entry => {
32             NAME => $name,
33             VERSION => $version
34             }
35             );
36             }
37 0           close $handle;
38             }
39              
40             1;