commit da7a0ae64572ce945820934a10e78fbd1e67900e
parent 004265df979938f0f43e597f0243cc746d899033
Author: Jacob Pipkin <j@dawnrazor.net>
Date: Tue, 5 Jun 2012 21:18:40 -0500
reduced extra code in sbofind, seems to also be faster? huh.
Diffstat:
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/sbofind b/sbofind
@@ -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} );
}