L
lnatz
I am trying to use Getopts::Std to make switches, some with arguments.
This is a piece of code from my overall script. UsageAndDie is a sub
created earlier in the script. If I don't use any switches, usageAndDie
is suppose to execute and print a warning. No matter what I do, even if
I don't use any switches UsageAndDie never works. And if I do use a
switch, lets say I use F to make a configuration file, $configFile is
not defined. I don't know what the problem is.
getopts('F:S:T:Ilen', \%OPTS);
$configFile = uc$OPTS{F};
$dbserver = uc$OPTS{S};
$database = uc$OPTS{D};
$table_name = uc$OPTS{T};
$purging_item = uc$OPTS{I};
$logical_delete = $OPTS{p};
$distinct_users = $OPTS{l};
$existing_users = $OPTS{e};
$nonexisting_users = $OPTS{n};
print "getting to use and die\n";
usageAndDie if (!defined $configFile
|| (!defined $dbserver
&& !defined $database
&& !defined $table_name
&& !defined $purging_item)) ;
This is a piece of code from my overall script. UsageAndDie is a sub
created earlier in the script. If I don't use any switches, usageAndDie
is suppose to execute and print a warning. No matter what I do, even if
I don't use any switches UsageAndDie never works. And if I do use a
switch, lets say I use F to make a configuration file, $configFile is
not defined. I don't know what the problem is.
getopts('F:S:T:Ilen', \%OPTS);
$configFile = uc$OPTS{F};
$dbserver = uc$OPTS{S};
$database = uc$OPTS{D};
$table_name = uc$OPTS{T};
$purging_item = uc$OPTS{I};
$logical_delete = $OPTS{p};
$distinct_users = $OPTS{l};
$existing_users = $OPTS{e};
$nonexisting_users = $OPTS{n};
print "getting to use and die\n";
usageAndDie if (!defined $configFile
|| (!defined $dbserver
&& !defined $database
&& !defined $table_name
&& !defined $purging_item)) ;