http://www.perlmonks.org?node_id=11155549


in reply to Re^2: poll ideas quest 2023 [Reasonable 'use VERSION' for new CPAN modules]
in thread poll ideas quest 2023

I like the idea of a "whatever minimum version the code itself requires" , but perlver doesn't seem to be the right tool. Sadly, it fails on features. Consider:

#!/usr/bin/perl $_ = []; my @a = $_->@*; say "@a";
----------------------------------------- | file | explicit | syntax | external | | ----------------------------------------- | | perlver.pl | ~ | ~ | n/a | | ----------------------------------------- | | Minimum explicit version : ~ | | Minimum syntax version : ~ | | Minimum version of perl : v5.4.0 (default) | -----------------------------------------

say requires v5.10 and 'postderef' requires v5.20. For say, even on more recent versions use feature 'say' is required unless use v5.10 is in effect, while 'postderef' is silently available from v5.24 on.

Greetings,
-jo

$gryYup$d0ylprbpriprrYpkJl2xyl~rzg??P~5lp2hyl0p$

Replies are listed 'Best First'.
Re^4: tangent: 'perlver' and 'postderef' (was: poll ideas quest 2023 [Reasonable 'use VERSION' for new CPAN modules])
by pryrt (Abbot) on Nov 10, 2023 at 20:49 UTC
    Sadly, it fails on features

    I was surprised, especially since the changelist shows perlver v1.39 should recognize postderef correctly. So I did some investigation:

    I don't think that passing code that doesn't compile should be expected to work "right" (and calling say without a use feature qw(say) or use v5.10 or newer doesn't compile), but I would expect perlver to complain about non-compiling code.

    If you explicitly use feature qw(postderef); , then perlver will correctly tell you that v5.20.0 is necessary; but you are right that it should recognize that v5.24-onward allow for postfix dereferencing without an explicit feature call, and actually look for the postfix dereferencing syntax.

    I also found that use feature qw(postderef say); will be recognized as needing v5.20.0, but use feature qw(say postderef); will claim it only requires 5.10.0.

    After doing that investigation, I have submitted three bug reports:

  • perlver should die if the script doesn't compile
  • perlver doesn't notice postderef unless it's explicitly called out
  • perlver doesn't notice postderef when combined in use feature list
Re^4: poll ideas quest 2023 [Reasonable 'use VERSION' for new CPAN modules]
by kcott (Archbishop) on Nov 10, 2023 at 19:38 UTC

    New option "Dynamic" covers this — see my reply to hippo.

    I've set up a number of standard Author tests for $work. One of these uses Test::MinimumVersion, which has Perl::MinimumVersion as a dependency. I'm aware of, and have documented, the limitations. Suggestions for something better would be most welcome.

    — Ken