Subject: | @joobs does not contain multiple values |
This looks like a sweet library, but I am unable to see multiple values
in the @joobs list (code attached).
Is there something that I'm doing wrong?
I had to change opt->{foobar} to opts->{foobar} to pick up the -f or
--foobar options.
Also, the code:
print $go->usage if MyModule::some_error_condition($opts);
did not seem to work in a standalone context.
I am running on Mac OS 10.5.1 with Perl version 5.8.8.
Subject: | getopt_compact.pl |
#!/usr/bin/perl
use Getopt::Compact;
use Data::Dumper;
use Getopt::Long;
my $go = new Getopt::Compact(
name => 'foobar program',
modes => [qw(verbose test debug)],
struct => [
[ [qw(w wibble)], qq(specify a wibble parameter), ':s' ],
[ [qw(f foobar)], qq(apply foobar algorithm) ],
[ [qw(j joobies)], qq(jooby integer list), '=i', \@joobs ],
]
);
my $opts = $go->opts;
print Dumper($go->opts);
print "applying foobar algorithm\n" if $opts->{foobar};
print "joobs: @joobs\n" if @joobs;