From 5211cb55c8ba4d52d171a810bffac2fafae850b5 Mon Sep 17 00:00:00 2001 From: Richard Hansen Date: Mon, 25 May 2020 22:36:31 -0400 Subject: [PATCH] Clean up `process_args` * Delete unused variable `%opts` * Ensure that `%opt` exists before it is referenced in `process_args` * Don't bother returning a copy of `%opt` --- ddclient | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ddclient b/ddclient index 205c24a..8488332 100755 --- a/ddclient +++ b/ddclient @@ -743,6 +743,9 @@ $variables{'merged'} = merge($variables{'global-defaults'}, map { $services{$_}{'variables'} } keys %services, ); +# This will hold the processed args. +my %opt = (); + my @opt = ( "usage: ${program} [options]", "options are:", @@ -810,7 +813,7 @@ my @opt = ( ); ## process args -my ($opt_usage, %opt) = process_args(@opt); +my $opt_usage = process_args(@opt); my ($result, %config, %globals, %cache); my $saved_cache = ''; my %saved_opt = %opt; @@ -1449,7 +1452,6 @@ sub usage { sub process_args { my @spec = (); my $usage = ""; - my %opts = (); foreach (@_) { if (ref $_) { @@ -1486,7 +1488,7 @@ sub process_args { if (! GetOptions(\%opt, @spec)) { $opt{"help"} = 1; } - return ($usage, %opt); + return $usage; } ###################################################################### ## test_possible_ip - print possible IPs