diff options
author | Jacob Pipkin <j@dawnrazor.net> | 2012-06-07 00:25:46 -0500 |
---|---|---|
committer | Jacob Pipkin <j@dawnrazor.net> | 2012-06-07 00:25:46 -0500 |
commit | adf44bcf0863ee1381ea3e2fbda849304141ea9c (patch) | |
tree | f454760592cb762245149ac7d17ca4fb856d5563 /SBO-Lib | |
parent | bee0f6f46820d537b301018317634c0727b425e6 (diff) | |
download | sbotools2-adf44bcf0863ee1381ea3e2fbda849304141ea9c.tar.xz |
cleanups and code reduction
Diffstat (limited to 'SBO-Lib')
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index fe4bf64..a8d5fd5 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -338,8 +338,7 @@ sub get_filename_from_link { } sub compute_md5sum { - script_error ('compute_md5sum requires an argument.') unless exists $_[0]; - script_error ('compute_md5sum argument is not a file.') unless -f $_[0]; + script_error ('compute_md5sum requires a file argument.') unless -f $_[0]; my $filename = shift; my $fh = open_read ($filename); my $md5 = Digest::MD5->new; @@ -511,14 +510,13 @@ sub grok_temp_file { my ($tempfn, $find) = @_; my $out; my $pkg_regex = qr/^Slackware\s+package\s+([^\s]+)\s+created\.$/; - my $src_regex = qr/^([^\/]+)\/.*$/; + my $src_regex = qr#^([^/]+)/.*$#; my $fh = open_read ($tempfn); FIRST: while (my $line = <$fh>) { if ($find eq 'pkg') { - last FIRST if $out = - ($line =~ /^Slackware\s+package\s+([^\s]+)\s+created\.$/)[0]; + last FIRST if $out = ($line =~ $pkg_regex)[0]; } elsif ($find eq 'src') { - last FIRST if $out = ($line =~ /^([^\/]+)\/.*$/)[0]; + last FIRST if $out = ($line =~ $src_regex)[0]; } } close $fh; |