> > Since I anticipate using this module in multiple programs,
> > I'd like to keep the parameter list as generic
> > as possible (in terms of order and requirements).
> 
> That is a worthy cause, but remember that the arguments
> that will be passed in need to be passed in a specific order:
> 
>       my ($input1, $input2) = qw/bob fried/;
>       my $answer1 = some_function($input1, $input2);
>       my $answer2 = some_function($input2, $input1);
> 
> are not the same inputs, since the ordering is important.

Right - which is why I was thinking Getopt would be an option
(pun intended).

> > For that reason, I'd like to use the Getopt::Long module
> > to parse the parameter list, but as far as I can tell it
> > will only look at @ARGV.  I could simply do a @ARGV = @_,
> > but I'd hate to alter @ARGV without knowing what might
> > still be there.
> 
> Have you thought about merely passing a reference to a Hash????
> And then managing the excecptions?

Excellent suggestion!  I should have thought of that before.
(I can tell I'm tired...)  Passing a hash would solve both the
required/optional and parameter order problem.

> > Does anyone know if Getopt can be pointed to a different 
> > array other than @ARGV?  I couldn't find anything in the
> > docs or in the archives.
> 
> if you do perldoc -m Getopt::Long you will notice that the
> module is using @ARGV, since it is a module for parsing the
> command line arguments, and not a general purpose parser.
> 
> Remember it is trying to deal with issues like
> 
>       -a -ifg --bob=frodo
> 
> and that is WAY too heavy for merely passing between functions.

Good point.  I had a feeling the idea was a bit over-engineered.
I knew Getopt could do what I wanted if I was using the command
line, and I thought I could tweek it for subs.

> > I am willing to write my own parser for the argument list 
> > (snip)
> > idea was to add the 5 non-required variables to @EXPORT_OK and set 
> 
> If it is any help, I sooo think that this is a bad idea.
> Exporting 'defaults' is, well, messy as you note, and
> may not even be taking you in the right direction.

That was my last choice.  Thanks for confirming my hesitation.

Thank you for your help.  I think I'll pass a hash as you
suggested and leave it at that.

Bob

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to