diff options
author | J Pipkin <j@dawnrazor.net> | 2013-03-02 03:14:03 -0600 |
---|---|---|
committer | J Pipkin <j@dawnrazor.net> | 2013-03-02 03:14:03 -0600 |
commit | aa6de2e5a364f062df3eda6129f5e9285161af3a (patch) | |
tree | 8f2919019bf4b5d9ee05b13d48219a0824ba770c | |
parent | fb0d444d3aed4100546a55bdf69903aa13cc7fe5 (diff) | |
download | sbotools2-aa6de2e5a364f062df3eda6129f5e9285161af3a.tar.xz |
return 0 instead of undef from get_sbo_location, test return with if instead of with if defined
-rw-r--r-- | SBO-Lib/lib/SBO/Lib.pm | 4 | ||||
-rwxr-xr-x | sboinstall | 2 | ||||
-rwxr-xr-x | sboupgrade | 2 | ||||
-rwxr-xr-x | t/test.t | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index 9b9c168..770e300 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -326,7 +326,7 @@ sub get_sbo_location { seek $fh, 0, 0; } close $fh; - return keys %locations > 0 ? %locations : undef; + return %locations; } # pull the sbo name from a $location: $config{SBO_HOME}/system/wine, etc. @@ -383,7 +383,7 @@ sub get_available_updates() { FIRST: for my $key (keys @$pkg_list) { my $location = get_sbo_location($$pkg_list[$key]{name}); # if we can't find a location, assume invalid and skip - next FIRST unless defined $location; + next FIRST unless $location; my $version = get_sbo_version $location; if (versioncmp($version, $$pkg_list[$key]{version}) == 1) { push @updates, { @@ -96,7 +96,7 @@ if ($no_reqs or $non_int) { %locations = get_sbo_location($build_queue); for my $sbo (@$build_queue) { usage_error "Unable to locate $sbo in the SlackBuilds.org tree." unless - defined $locations{$sbo}; + $locations{$sbo}; if ($compat32) { usage_error "-p|--compat32 is not supported with Perl SBos." if $locations{$sbo} =~ qr|/perl/[^/]+$|; @@ -99,7 +99,7 @@ for my $sbo (@sbos) { $name =~ s/-compat32//; $locations{$sbo} = get_sbo_location($name); usage_error "Unable to locate $sbo in the SlackBuilds.org tree." unless - defined $locations{$sbo}; + $locations{$sbo}; if ($sbo =~ /-compat32$/) { usage_error "compat32 Perl SBos are not supported." if $locations{$sbo} =~ qr|/perl/[^/]+$|; @@ -102,7 +102,7 @@ print "completed pseudo-random testing of get_installed_packages 'ALL' \n"; # get_sbo_location tests is(get_sbo_location ('nginx'), "$sbo_home/network/nginx", 'get_sbo_location is good'); -is(get_sbo_location ('omgwtfbbq'), undef, +is(get_sbo_location ('omgwtfbbq'), 0, 'get_sbo_location returns false with not-an-sbo input'); my @finds = qw(nginx gmpc); my %locs = get_sbo_location(@finds); |