diff options
author | Jacob Pipkin <j@dawnrazor.net> | 2012-06-05 21:18:40 -0500 |
---|---|---|
committer | Jacob Pipkin <j@dawnrazor.net> | 2012-06-05 21:18:40 -0500 |
commit | da7a0ae64572ce945820934a10e78fbd1e67900e (patch) | |
tree | 650b18aaa7e172a9e431a1c6dcbf83c3e090b8d3 | |
parent | 004265df979938f0f43e597f0243cc746d899033 (diff) | |
download | sbotools2-da7a0ae64572ce945820934a10e78fbd1e67900e.tar.xz |
reduced extra code in sbofind, seems to also be faster? huh.
-rwxr-xr-x | sbofind | 11 |
1 files changed, 4 insertions, 7 deletions
@@ -50,21 +50,18 @@ slackbuilds_or_fetch (); # find anything with $search in its name my (@findings, $name); my $found = 'FALSE'; -my $regex = qr/NAME:\s.*\Q$search\E.*/i; +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 ($line =~ $regex) { + if ($name = ($line =~ $name_regex)[0]) { $found = 'TRUE'; - my @split = split (' ', $line); - chomp ($name = $split[2]); next FIRST; } } else { - if ($line =~ /LOCATION/) { + if (my ($location) = ($line =~ $loc_regex)[0]) { $found = 'FALSE'; - my @split = split (' ', $line); - chomp (my $location = $split[2]); $location =~ s#^\.##; push (@findings, {$name => $config{SBO_HOME} . $location} ); } |