Skip Menu |

This queue is for tickets about the Getopt-Compact CPAN distribution.

Report information
The Basics
Id: 32055
Status: open
Priority: 0/
Queue: Getopt-Compact

People
Owner: Nobody in particular
Requestors: gavin.jackson [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.04
Fixed in: (no value)



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;
Subject: Re: [rt.cpan.org #32055] @joobs does not contain multiple values
Date: Tue, 8 Jan 2008 12:00:05 +0000
To: bug-Getopt-Compact [...] rt.cpan.org
From: Andrew <sobakasu [...] gmail.com>
Hi, I ran the code like this: andreww@pandora:~$ ./test.pl -j 1 -j 2 -j 3 $VAR1 = { 'joobies' => undef, 'verbose' => undef, 'test' => undef, 'foobar' => undef, 'wibble' => undef, 'man' => undef, 'help' => undef, 'debug' => undef }; joobs: 1 2 3 so i'm getting multiple values in @joobs. The method of getting multiple values is a bit silly, really. it should just put the list values in $opts->{joobies} and use the getopt long syntax for specifying a list (=@ i think?). On Jan 3, 2008 4:14 AM, Gavin Jackson via RT <bug-Getopt-Compact@rt.cpan.org> wrote: Show quoted text
> > Wed Jan 02 23:14:55 2008: Request 32055 was acted upon. > Transaction: Ticket created by gavz > Queue: Getopt-Compact > Subject: @joobs does not contain multiple values > Broken in: 0.04 > Severity: Important > Owner: Nobody > Requestors: gavin.jackson@gmail.com > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=32055 > > > > 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. > > #!/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; > >