diff options
author | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-02-29 13:00:58 +0100 |
---|---|---|
committer | Andreas Guldstrand <andreas.guldstrand@gmail.com> | 2016-02-29 13:00:58 +0100 |
commit | 4c8ad8f38a492490fe725026c78303d04f8dbee9 (patch) | |
tree | 2d245ecec911a38f4b1e42990f805493a0ba1144 /sbocheck | |
parent | e0a581fa19feecdacf5debc6a6a4699e0fe6be9a (diff) | |
download | sbotools2-4c8ad8f38a492490fe725026c78303d04f8dbee9.tar.xz |
Change get_update_list to return a list instead of a ref
Diffstat (limited to 'sbocheck')
-rwxr-xr-x | sbocheck | 15 |
1 files changed, 7 insertions, 8 deletions
@@ -109,16 +109,15 @@ sub get_update_list { } push @listing, $str; } - return \@listing; + return @listing; } # print list of updates sub print_output { - exists $_[0] or script_error('print_output requires an argument'); - my $listing = shift; - if (exists $$listing[0]) { + my @listing = @_; + if (@listing) { print "\n"; - say $_ for @$listing; + say $_ for @listing; print "\n"; # save a log of available updates my $logfile = '/var/log/sbocheck.log'; @@ -128,7 +127,7 @@ sub print_output { if ($exit) { warn $log_fh if $exit; } else { - say {$log_fh} $_ for @$listing; + say {$log_fh} $_ for @listing; close $log_fh; say "A copy of the above result is kept in $logfile\n"; } @@ -137,7 +136,7 @@ sub print_output { } } -my $output = get_update_list(); -print_output($output); +my @listing = get_update_list(); +print_output(@listing); exit 0; |