Skip to content

Commit

Permalink
saner interface: use return value instead of parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
guillomovitch committed Nov 7, 2012
1 parent 2b5cb26 commit 5aa99eb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/FusionInventory/Agent/Task/Inventory/Input/Win32/License.pm
Expand Up @@ -28,11 +28,9 @@ sub doInventory {

my $office = $machKey->{"SOFTWARE/Microsoft/Office"};

my @found;
my @licenses = _scanOffice($office);

_scanOffice($office, \@found);

foreach my $license (@found) {
foreach my $license (@licenses) {
$params{inventory}->addEntry(
section => 'LICENSEINFOS',
entry => $license
Expand All @@ -42,7 +40,7 @@ sub doInventory {
}

sub _scanOffice {
my ($currentKey, $found) = @_;
my ($currentKey) = @_;

my %license;
if ($currentKey->{ProductID}) {
Expand Down Expand Up @@ -83,12 +81,16 @@ sub _scanOffice {
if (@products) {
$license{COMPONENTS} = join('/', @products);
}
push @$found, \%license if $license{KEY};

my @licenses;
push @licenses, \%license if $license{KEY};

foreach my $subKey ( $currentKey->SubKeyNames ) {
next if $subKey =~ /\//; # Oops, that's our delimitator
_scanOffice($currentKey->{$subKey}, $found);
push @licenses, _scanOffice($currentKey->{$subKey});
}

return @licenses;
}

1;

0 comments on commit 5aa99eb

Please sign in to comment.