[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Stanford IDG internal Perl style



Niels Thykier <niels@thykier.net> writes:

> I tried to convert lintian-info to Getopt::Long::Descriptive today.
> Attached is a functional patch as far as I have tested.
>   I wonder why you recommend the use of the "short" option first.  It
> seems to me that putting the long option first will be much more
> descriptive later.  Example from lintian-info being:

>   $opt->mode eq 't' instead of $opt->mode eq 'tags'
>   $opt->h instead of $opt->help

Yeah, I was looking at that when I reviewed the document, and I think
that's backwards.  It's left over from an old style we had for
Getopt::Long where it didn't matter.  I'm going to change that.

> Regarding the use of:

> Usage: lintian-info ...
> Usage: lintian-info --annotate
> Usage: lintian-info --tags ...

> For some reason, it only treats newlines as newlines if they are not
> followed by \t or space.  Possible reasons could be that the string is
> "s/\s\s++/ /"'ed, but I haven't checked the code.

Oh, that's kind of annoying.  Although we conventionally ommitted the
Usage: for subsequent lines anyway and just said:

    Usage: lintian-info ...
           lintian-info --annotate
           lintian-info --tags ...

>>         my ($opt, $usage = describe_options(
>>           '$0 $o <args>',
>>           [ 'd|delete', 'delete the given object' ],
>>           [ 'e|exclude=s', 'exclude any matching names' ],
>>           [ 'h|help',      'display help' ],
>>         ) or exit 1;

> The "or exit 1" appear to be useless.  AFAICT, describe_options does not
> return on bad options.  Instead it exists with 255 (I suspect it ends up
> calling die via $usage->die).

Indeed.  Will fix.

Thanks for the review!

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: