diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-03-03 14:53:18 +0100 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-03-03 14:53:18 +0100 |
commit | 30b1aa84d602a648139ae78f00b94dc9ded666bf (patch) | |
tree | 3bdaa78c53cbc18a738af15eb0cec00c9561d6d3 /sboclean | |
parent | 5ecef1547e12d76c5a7157f65a90937511600b1b (diff) | |
download | sbotools-30b1aa84d602a648139ae78f00b94dc9ded666bf.tar.xz |
sbo*: Add returns to subs missing them and check @_ better
Diffstat (limited to 'sboclean')
-rwxr-xr-x | sboclean | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -21,7 +21,7 @@ use File::Path qw(remove_tree); my $self = basename($0); sub show_usage { - print <<EOF + print <<"EOF"; Usage: $self (options) [package] Options: @@ -37,6 +37,7 @@ Options: be interactive. EOF + return 1; } my ($help, $vers, $clean_dist, $clean_work, $interactive); @@ -56,7 +57,7 @@ usage_error("You must specify at least one of -d or -w.") unless ($clean_dist || $clean_work); sub rm_full { - exists $_[0] or script_error('rm_full requires an argument.'); + @_ == 1 or script_error('rm_full requires an argument.'); my $full = shift; if ($interactive) { print "Remove $full? [n] "; @@ -68,9 +69,9 @@ sub rm_full { } sub remove_stuff { - exists $_[0] or script_error 'remove_stuff requires an argument.'; - -d $_[0] or say 'Nothing to do.' and return 0; + @_ == 1 or script_error 'remove_stuff requires an argument.'; my $dir = shift; + -d $dir or say 'Nothing to do.' and return 0; opendir(my $dh, $dir); FIRST: while (my $ls = readdir $dh) { next FIRST if in($ls => qw/ . .. /); @@ -86,6 +87,7 @@ sub clean_c32 { next FIRST unless $ls =~ /^package-.+-compat32$/; rm_full("$dir/$ls"); } + return 1; } remove_stuff($config{SBO_HOME} .'/distfiles') if $clean_dist; |