good start!
# at this point consider adding all your parameters into a hash and # pass that to http_tiny($options) instead of passing a long list whic +h # may contain optional parameters. my %h; $h{infile} = $infile; ...
Note that you can pack all into a hash from the beginning avoiding myriads of loose variables:
my %h; # or %params ... Getopt::Long::GetOptions( 'infile=s' => \$h{infile}, # or more flexible: 'outfile=s' => sub { $h{$_[0]} = $_[1] }, # the anonymous sub above will be called with 2 params # when --outfile is detected: the key (outfile) and its value ... }
Also, the sub get_... (secrets) is a good example where error checking is important. The sub itself does not check whether it found the secrets pair in the config file or whether it managed to open the file. It returns a pair of possibly undefined values (if it does not bomb midway because of IO errors). And you do not check its return value: it will be a pair but will it have defined values? Personally I prefer to pass into subs hash/array refs and return back hash/array refs. In this way if it returns undef then I know an error occured.
sub get_... { if( /error/ ){ print STDERR "errors"; return undef } return [$url, $key]; } # use it my $ret = get_...(); if( ! defined $ret ){ print STDERR "call to get_...() has failed"; exi +t(1) } my ($url, $key) = @$ret;
Apropos the translation, it is impressively good. The *$&?^%$^* will sell the rope with which to be "hanged" but with the current logistics standstill, keep spinning those yarns on the ol'spindle, with Perl, hehehe
bw, bliako
In reply to Re^7: De-googleizing translation scripts
by bliako
in thread De-googleizing translation scripts
by Aldebaran
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |