A
aether8203
I am trying to use GetOptions in such a way that if the user does not
provide the correct mandatory arguments, the usage sub is called. The
problem is that even when I call it correctly, it is going into the
usage() sub. Can you see anything from the example below?
# parse command line args
{
my $show_usage = 0;
Getopt::Long::config('bundling');
GetOptions(
'h|help' => \$show_usage,
'l|location=s' => \$location,
'b|base=s' => \$base
) or $show_usage = 1;
if ($show_usage == 1) { usage(); exit 64 }
}
sub usage() {
print <<EOF;
Usage: $0 .... etc
EOF
}
provide the correct mandatory arguments, the usage sub is called. The
problem is that even when I call it correctly, it is going into the
usage() sub. Can you see anything from the example below?
# parse command line args
{
my $show_usage = 0;
Getopt::Long::config('bundling');
GetOptions(
'h|help' => \$show_usage,
'l|location=s' => \$location,
'b|base=s' => \$base
) or $show_usage = 1;
if ($show_usage == 1) { usage(); exit 64 }
}
sub usage() {
print <<EOF;
Usage: $0 .... etc
EOF
}