I'd like to use the Getopt::Long module at two places: 1) in a generic module providing various general purpose tasks and 2) in a script doing some specific task. This script is of course using the module mentioned under 1). So we have:
The script (I called it mgo.pl for Multiple GetOpt):
The module (MGO.pm):#!/usr/bin/perl -w use MGO; use Getopt::Long; GetOptions('help' => \ (my $help), 'version' => \ (my $version), ); print "HELP : $help\n" if(defined $help); print "VERS.: $version\n" if(defined $version);
package MGO; use Getopt::Long; GetOptions('cpu=i' => \ (my $cpu), 'quiet' => \ (my $quiet), ); print "CPU : $cpu\n" if(defined $cpu); print "QUIET: $quiet\n" if(defined $quiet); 1;
Now no matter what I do, I get for every option, that is not defined in MGO.pm an "unknown option: <option>". How do I tell GetOpt::Long to ignore unknown options (the docs are silent about this)? Or how do I split the Options processing in the above meantioned way?
Thanks for any hints.
Bye
PetaMem All Perl: MT, NLP, NLU
In reply to Multiple GetOptions? by PetaMem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |