diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-11-14 03:03:55 +0100 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2015-11-14 03:03:55 +0100 |
commit | eaa18fd91c51c136ff6ec607d46d32b87a2ea34f (patch) | |
tree | b5d5cf8fe7b7adf75694f205ab9ca7dfded501d3 /sboclean | |
parent | 38623091f241bd53975cf685136bab57f78c255e (diff) | |
download | sbotools-eaa18fd91c51c136ff6ec607d46d32b87a2ea34f.tar.xz |
Remove prototypes and make sure subs are called with ()
Diffstat (limited to 'sboclean')
-rwxr-xr-x | sboclean | 28 |
1 files changed, 14 insertions, 14 deletions
@@ -19,7 +19,7 @@ use File::Path qw(remove_tree); my $self = basename($0); -sub show_usage() { +sub show_usage { print <<EOF Usage: $self (options) [package] @@ -48,14 +48,14 @@ GetOptions( 'interactive|i' => \$interactive, ); -show_usage and exit 0 if $help; -show_version and exit 0 if $vers; +show_usage() and exit 0 if $help; +show_version() and exit 0 if $vers; -usage_error "You must specify at least one of -d or -w." unless +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.'; +sub rm_full { + exists $_[0] or script_error('rm_full requires an argument.'); my $full = shift; if ($interactive) { print "Remove $full? [n] "; @@ -66,27 +66,27 @@ sub rm_full($) { return 1; } -sub remove_stuff($) { +sub remove_stuff { exists $_[0] or script_error 'remove_stuff requires an argument.'; -d $_[0] or say 'Nothing to do.' and return 1; my $dir = shift; opendir(my $dh, $dir); FIRST: while (my $ls = readdir $dh) { next FIRST if $ls =~ /^(\.){1,2}$/; - rm_full "$dir/$ls"; + rm_full("$dir/$ls"); } } -sub clean_c32() { +sub clean_c32 { my $dir = $SBO::Lib::tmpd; opendir(my $dh, $dir); FIRST: while (my $ls = readdir $dh) { next FIRST unless $ls =~ /^package-.+-compat32$/; - rm_full "$dir/$ls"; + rm_full("$dir/$ls"); } } -remove_stuff $config{SBO_HOME} .'/distfiles' if $clean_dist; +remove_stuff($config{SBO_HOME} .'/distfiles') if $clean_dist; if ($clean_work) { my $env_tmp = $SBO::Lib::env_tmp; @@ -94,11 +94,11 @@ if ($clean_work) { if ($env_tmp && !$interactive) { warn "This will remove the entire contents of $env_tmp\n"; print "Proceed? [y] "; - remove_stuff $tsbo if <STDIN> =~ /^[yY\n]/; + remove_stuff($tsbo) if <STDIN> =~ /^[yY\n]/; } else { - remove_stuff $tsbo; + remove_stuff($tsbo); } - clean_c32; + clean_c32(); } exit 0; |