[Pdx-pm] Getopt::Modern usage model

Austin Schutz tex at off.org
Thu Jun 9 21:49:48 PDT 2005


On Thu, Jun 09, 2005 at 08:39:35PM -0700, Tom Phoenix wrote:
> On 6/9/05, Eric Wilhelm <ewilhelm at sbcglobal.net> wrote:
> > >Also, please allow --foo=3 to be a synonym for --foo 3.
> > 
> > The trouble here is that you don't get shell interpolation for the
> > stuff after the equals:
> 
> Maybe it's a feature, not a bug. Document it as one way to pass
> parameters without the shell messing with what you type.
> 
> What? Why are you looking at me like that?
> 

	Autoconf has changed a fair amount, but in relatively recent versions
it did the same thing- if you wanted to use ~ you referred to it as $HOME.
	Come to think of it, I don't see why you need to monkey with it
at all. If the author wants to interpolate ~ all they have to do is
s/^~/$ENV{HOME}/. Document it as a gotcha for the author to be aware of.
	Also by doing that you can pass off responsibility for cases where
the user didn't want shell interpolation, --foo='~' or similar. Otherwise
there's no way of knowing. Actually, that makes it a good excuse for calling
this "the right thing to do", which I would propose that it is.
	I can imagine a case where a script is passed a ~ delimited file,
where the author doesn't want the script to be trying to split on $HOME. So,
let the author choose not to do expansion or not.

	Austin


More information about the Pdx-pm-list mailing list