From eaa18fd91c51c136ff6ec607d46d32b87a2ea34f Mon Sep 17 00:00:00 2001 From: Andreas Guldstrand Date: Sat, 14 Nov 2015 03:03:55 +0100 Subject: Remove prototypes and make sure subs are called with () --- sbofind | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'sbofind') diff --git a/sbofind b/sbofind index 807f733..958545b 100755 --- a/sbofind +++ b/sbofind @@ -7,6 +7,7 @@ # # authors: Jacob Pipkin # Luke Williams +# Andreas Guldstrand # license: WTFPL use 5.16.0; @@ -18,7 +19,7 @@ use Getopt::Long qw(:config bundling); my $self = basename($0); -sub show_usage() { +sub show_usage { print < \$show_queue, ); -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; -show_usage and exit 1 unless exists $ARGV[0]; +show_usage() and exit 1 unless exists $ARGV[0]; my $search = $ARGV[0]; # if we can't find SLACKBUILDS.TXT in $config{HOME}, prompt to fetch the tree -slackbuilds_or_fetch; +slackbuilds_or_fetch(); # find anything with $search in its name -sub perform_search($) { +sub perform_search { exists $_[0] or script_error 'perform_search requires an argument.'; my $search = shift; my (@findings, $name, $found); @@ -86,10 +87,10 @@ sub perform_search($) { } # pull the contents of a file into a variable and format it for output -sub get_file_contents($) { +sub get_file_contents { exists $_[0] or script_error 'get_file_contents requires an argument'; -f $_[0] or return "$_[0] doesn't exist.\n"; - my ($fh, $exit) = open_read shift; + my ($fh, $exit) = open_read(shift); if ($exit) { warn $fh; return; @@ -103,24 +104,23 @@ sub get_file_contents($) { } # get build queue and return it as a single line. -sub show_build_queue($) { - exists $_[0] or script_error 'show_build_queue requires an argument.'; +sub show_build_queue { + exists $_[0] or script_error('show_build_queue requires an argument.'); my $queue = get_build_queue([shift], {}); return join(" ", reverse @$queue); } -my $findings = perform_search $search; +my $findings = perform_search($search); # pretty formatting if (exists $$findings[0]) { - my @listing = ("\n"); for my $hash (@$findings) { while (my ($key, $val) = each %$hash) { say "SBo: $key"; say "Path: $val"; - say "info: ". get_file_contents "$val/$key.info" if $show_info; - say "README: ". get_file_contents "$val/README" if $show_readme; - say "Queue: ". show_build_queue "$key" if $show_queue; + say "info: ". get_file_contents("$val/$key.info") if $show_info; + say "README: ". get_file_contents("$val/README") if $show_readme; + say "Queue: ". show_build_queue("$key") if $show_queue; say ''; } } -- cgit v1.2.3