diff options
| author | Jacob Pipkin <j@dawnrazor.net> | 2012-11-04 14:01:12 -0600 | 
|---|---|---|
| committer | Jacob Pipkin <j@dawnrazor.net> | 2012-11-04 14:01:12 -0600 | 
| commit | 1f448412a2dadf308689e40d9694a109e510e835 (patch) | |
| tree | 4caa3a466765a19dffc69522994baf6273f48e1c /SBO-Lib | |
| parent | b44271a81f96a195c2f7540b86899e00f5028b89 (diff) | |
| download | sbotools2-1f448412a2dadf308689e40d9694a109e510e835.tar.xz | |
make get_sbo_location state-keeping more correct, rename $loc_store to $store
Diffstat (limited to 'SBO-Lib')
| -rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 13 | 
1 files changed, 7 insertions, 6 deletions
| diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index ba7eb19..e33296c 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -226,21 +226,22 @@ sub get_sbo_location {  		my $tmp = $sbos[0];  		@sbos = @$tmp;  	} -	state $loc_store = {}; +	state $store = {};  	# if scalar context and we've already have the location, return it now.  	unless (wantarray) { -		return $$loc_store{$sbos[0]} if exists $$loc_store{$sbos[0]}; +		return $$store{$sbos[0]} if exists $$store{$sbos[0]};  	}  	my %locations;  	my $fh = open_read $slackbuilds_txt; -	for my $sbo (@sbos) { +	FIRST: for my $sbo (@sbos) { +		$locations{$sbo} = $store{$sbo}, next FIRST if exists $$store{$sbo};  		my $regex = qr#LOCATION:\s+\.(/[^/]+/\Q$sbo\E)$#;  		while (my $line = <$fh>) {  			if (my $loc = ($line =~ $regex)[0]) {  				# save what we found for later requests -				$$loc_store{$sbo} = "$config{SBO_HOME}$loc"; -				return $$loc_store{$sbo} unless wantarray; -				$locations{$sbo} = $$loc_store{$sbo}; +				$$store{$sbo} = "$config{SBO_HOME}$loc"; +				return $$store{$sbo} unless wantarray; +				$locations{$sbo} = $$store{$sbo};  			}  		}  		seek $fh, 0, 0; | 
