develooper Front page | perl.perl5.porters | Postings from May 2003

Getopt::Long automatic help/version revisited

Thread Next
From:
jvromans
Date:
May 14, 2003 01:56
Subject:
Getopt::Long automatic help/version revisited
Message ID:
16066.1189.844501.610684@phoenix.squirrel.nl
From studying the feedback, it is clear that Getopt::Long would need
configuration parameters to enable/disable automated help and version
support.

To use these new parameters, the application must make sure they are
supported by the Getopt::Long module that is installed, so they will
have to use an explicit version requirement anyway.

The remaining question is the default values for these new parameters.
I'm personally inclined to enable automated help and version support
when use application requires an explicit version >= 2.33, and to
disable otherwise. This leads to the following 'case analysis':

 1. Applications that do not use, nor want to use, automated
    version/help messages.

    They just keep on "use Getopt::Long" as always.

 2. Applications that want to use automated version/help messages.

    They must be sure that the installed version supplies the desired
    features, so they have to "use Getopt::Long 2.33" anyway.

 3. Applications that don't care.

    They just keep on "use Getopt::Long", and don't get the new
    features. 

 4. Applications that do want the automated version/help if provided,
    and otherwise don't care.

    They loose. They just keep on "use Getopt::Long", and won't get
    the new features.

 5. Applications which have to have  to say        
    use Getopt::Long qw(:config no_ignore_case);
    anyway so would not mind saying 
    use Getopt::Long qw(:config no_ignore_case help no_version);

    See 7 and 8.

 6. Applications that want to use automated version/help messages 
    and are bundled with a copy of perl5.8.* and a Getopt::Long
    (a core module these day) of their choice.

    See 2.

 7. Applications written in 2005 for perl5.12 which need this cargo-cult 
    2.33 in the use line 'cos that is how you turn on -help.

    Use config parameters:

    use Getopt::Long qw(:config help version);

    Of course, you'd better check that your installation supports
    these config parameters...

 8. Applications that need to specify a later version of Getopt::Long
    to get some (future) new feature, but _don't_ want the version/help
    support.

    Use config parameters:

    use Getopt::Long 2.66 qw(:config nohelp noversion);

-- Johan

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About