This is a question about Perl. It involves a 924 lines utility,
dupload.
The problem:
$ dupload --no -c myApp
dupload fatal error: Need host to upload to. (See --to option or the
default_host configuration variable)
at /usr/bin/dupload line 142
$cat -n dupload|grep 142
142 $host or fatal("Need host to upload to. (See --to option or the
default_host configuration variable)\n");
The question:
How come that in the following piece of code, moving the 4th line
($host = ...) to be after the 9th line (configure ...) solves the error
from above? What side effects would this move have?
I guess that I would be better searching for the word configure in the
utility. Here it is:
$debug = $::opt_debug || $debug;
$keep = $::opt_keep || $keep;
$configfile = $::opt_configfile || $configfile;
$host = $::opt_to || $config::default_host;
$force = $::opt_force || $force;
$nomail = $::opt_nomail || 0;
$quiet = $::opt_quiet;
configure("./dupload.conf") if $configfile;
# only info or version?
info($host), exit 0 if $::opt_print;
The appearances of the word configure in the utility are as follows:
### Prototypes
sub configure(@); # reads the config file(s)
.
.
.
### Main
configure(
"/etc/dupload.conf",
$ENV{HOME} && "$ENV{HOME}/.dupload.conf");
$Getopt::Long::ignorecase = 0;
GetOptions qw(
debug:i
help
force keep configfile no nomail noarchive
mailonly
to=s print
quiet Version version
) or fatal("Bad Options\n");
.
.
.
configure("./dupload.conf") if $configfile;
.
.
.
### Read the configuration
sub configure(@) {
my @conffiles = @_;
my @read = ();
foreach (@conffiles) {
-r or next;
-s or next;
do $_ or fatal("[EMAIL PROTECTED]");
push @read, $_;
}
@read or fatal("No configuration files\n");
}
=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]