in reply to Getopt::Long good style?
as you can see, it's long, and there are a number of functions that have to be called to deal with the vagaries of what i need & want.GetOptions(\%runconfig, "load=s" => \&loadAttributeDescriptions, "loadconfig=s" => \&loadconfig, "dumpconfig=s" => \$dumpconfig, "tables=s" => \$tables, "prec:i" => \$precision, "decorate" => \$decorate, "i=s@", # include a nominal field. "arff", # arff file [data mining] "max:i", # examine file to this length "quiet", # do not spit out csv "filter=s" => \&addfilter, "cp=s" => \&addcp, # array of [ant [ dependents ] ] "cptformat=s", # cp table format "prune", # get rid of 0 info columns "help" => \$help, "man" => \$man ) or pod2usage(-verbose=>1) && exit(1);
useful, but it requires the overhead of a function, which goes something like...cptplus.pl --cp="charm|perlmonk,cyberpunk,neovictorian"
not particularly complex - but there are a number of these functions that i call. and do i want them littering the call to GetOptions, where they not only look ugly, but prevent me breaking at them easily in my debugger?sub addcp{ my $cpstring = $_[1]; $cpstring =~ s/^([A-Za-z\-\_0-9]+)\|//; my $antecedent = $1 || return; my @dependents = split(/,/, $cpstring); my @cptrequest = ($antecedent, \@dependents); push @{$runconfig{"cp"}},(\@cptrequest); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Getopt::Long good style?
by Skeeve (Parson) on Jul 28, 2004 at 13:37 UTC |