hippo has asked for the wisdom of the Perl Monks concerning the following question:

Perusing the documentation of GetOpt::Std in perl 5.20 I noticed that it declared (in bold, no less), "Use of "getopts()" is not recommended." which seemed a bit odd. So I dug a little deeper into the docs and found that in more recent versions such as that bundled with perl 5.22 the recommendation was now the complete opposite, "Use of getopt() is not recommended."

There is nothing explicit I could spot in the changelog to explain this and it's a bit odd that the newer documentation doesn't refer to the older version or mention the change. Surely something like a complete reversal of which subroutine is recommended by the author ought to be highlighted in a fairly obvious manner?

Can anyone point me to an explanation for the change?

  • Comment on GetOpt::Std change of recommended subroutine

Replies are listed 'Best First'.
Re: GetOpt::Std change of recommended subroutine
by haukex (Archbishop) on Feb 16, 2017 at 10:06 UTC

    Hi hippo,

    TL;DR: It was supposed to be "Use of getopt() is not recommended" all along.

    1. The discussion in RT#116098 resulted in getopt being not recommended, resulting in commit 0c0a84c (first in v5.19.0, part of v5.20.0), the wording was "The getopt() function is similar ... Its use is not recommended."
    2. RT#41359 doesn't deal with the getopt vs getopts issue, instead it's a different Getopt::Std documentation issue, the resulting patch 243ac78 (first in v5.19.3, part of v5.20.0) rewords the relevant paragraphs, but unfortunately contained a typo which said "Use of getopts() is not recommended" instead of "Use of getopt() is not recommended"
    3. I reported that typo and it was fixed in 624c6f9 (first in v5.21.4, part of v5.22.0). Unfortunately it does not seem to have made it into perl5220delta. Update: Although backporting the fix into the v5.20.x series was mentioned, it seems that didn't happen.

    Regards,
    -- Hauke D

Re: GetOpt::Std change of recommended subroutine
by Anonymous Monk on Feb 15, 2017 at 15:04 UTC

      Thank you - that looks to be precisely it. I should have thought to search at rt.perl.org myself.