Greg London wrote:
>
> Bob Rogers wrote:
> > I have places where the command_line_options method calls
> > SUPER::command_line_options in order to replace/rename options, so I
> > need some way to supercede and/or rename things.
Hey, just a random thought, but rather than building up a simple
string in a global variable, could you build up a global hash?
The key would be the option like -in and the value would be
the string that eventually gets concatenated and passed to
Getopt::Declare.
package SomeModule;
BEGIN {
$SmartArgs::getopt_declare_hash{'-in'} = <<'INTERFACE';
-in <filename> Set the input file to 'filename'
{$main::filename = $filename;}
INTERFACE
}
1;
package SomeOtherModule
BEGIN {
# rename -in to -input
delete($SmartArgs::getopt_declare_hash{'-in'});
$SmartArgs::getopt_declare_hash{'-input'} = <<'INTERFACE';
-input <filename> Set the input file to 'filename'
{$main::filename = $filename; }
INTERFACE
}
1;
package SmartArgs;
our %getopt_declare_hash;
CHECK {
my $string = keys (%getopt_declare_hash);
my $command_line_object = Getopt::Declare->new($string);
}
1;
Then, your main script would use SmartArgs to get the command line parsing working,
and all the other modules would use the global hash in SmartArgs to
declare/delete/rename/change the arguments.
Hm, might have to put that on my to-do list.
_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm