From 5aa99eb2ca31965ff91c928156a71ff1d65048c8 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse Date: Wed, 7 Nov 2012 09:09:12 +0100 Subject: [PATCH] saner interface: use return value instead of parameters --- .../Agent/Task/Inventory/Input/Win32/License.pm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/License.pm b/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/License.pm index 8a70f6fe9b..1d14b118fb 100644 --- a/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/License.pm +++ b/lib/FusionInventory/Agent/Task/Inventory/Input/Win32/License.pm @@ -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 @@ -42,7 +40,7 @@ sub doInventory { } sub _scanOffice { - my ($currentKey, $found) = @_; + my ($currentKey) = @_; my %license; if ($currentKey->{ProductID}) { @@ -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;