diff options
author | Jacob Pipkin <j@dawnrazor.net> | 2012-06-11 21:10:21 -0500 |
---|---|---|
committer | Jacob Pipkin <j@dawnrazor.net> | 2012-06-11 21:10:21 -0500 |
commit | 3fe7112f8c96478a55eeebe0d63665c1435c5dda (patch) | |
tree | b95d8dd689c7320331367f04e1bdd8855a91057d /sbofind | |
parent | d3db332c7d9bab3be5cbb04e1d9283627048ee05 (diff) | |
download | sbotools2-3fe7112f8c96478a55eeebe0d63665c1435c5dda.tar.xz |
code reductions
Diffstat (limited to 'sbofind')
-rwxr-xr-x | sbofind | 21 |
1 files changed, 9 insertions, 12 deletions
@@ -54,16 +54,13 @@ my $name_regex = qr/NAME:\s+(.*\Q$search\E.*)$/i; my $loc_regex = qr/LOCATION:\s+(.*)$/; my $fh = open_read ("$config{SBO_HOME}/SLACKBUILDS.TXT"); FIRST: while (my $line = <$fh>) { - unless ($found eq 'TRUE') { - if ($name = ($line =~ $name_regex)[0]) { - $found = 'TRUE'; - next FIRST; - } + if ($found eq 'FALSE') { + $found eq 'TRUE', next FIRST if $name = ($line =~ $name_regex)[0]; } else { if (my ($location) = ($line =~ $loc_regex)[0]) { $found = 'FALSE'; $location =~ s#^\.##; - push (@findings, {$name => $config{SBO_HOME} . $location} ); + push @findings, {$name => $config{SBO_HOME} . $location}; } } } @@ -83,13 +80,13 @@ if (exists $findings[0]) { my @listing = ("\n"); for my $hash (@findings) { while (my ($key, $value) = each %{$hash}) { - push (@listing, "SBo: $key\n"); - push (@listing, "Path: $value\n"); - push (@listing, "info: ". get_file_contents - ("$value/$key.info") ) if $show_info eq 'TRUE'; - push (@listing, "README: ". get_file_contents ("$value/README") ) + push @listing, "SBo: $key\n"; + push @listing, "Path: $value\n"; + push @listing, "info: ". get_file_contents ("$value/$key.info") + if $show_info eq 'TRUE'; + push @listing, "README: ". get_file_contents ("$value/README") if $show_readme eq 'TRUE'; - push (@listing, "\n"); + push @listing, "\n"; } } print $_ for @listing; |