What's the modern way of declaring which version of Perl to use?

后端 未结 3 556
猫巷女王i
猫巷女王i 2021-02-01 07:08

When it come to saying what version of Perl we need for our scripts, we\'ve got options, oh, brother, we\'ve got options:

use 5.010;
use 5.010_001;
use 5.10.0;
u         


        
3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 07:40

    I just use something like 5.010_001. I've grow weary of dealing with version string problems for something that should be mind-numbingly simple.

    Since I mostly deal with build systems, I have the constant struggle of Module::Build's internal version.pm which is out of sync with the version.pm on CPAN. I think that's mostly better now, but I have better things to think about.

    The best practice should always be to do the thing that commands the least of your attention, and certainly not take more attention than the value it gives back. In my opinion, v-strings and dotted decimals were a huge distraction with no additional benefit, wasting a lot of valuable programmer time just to get back to the starting point.

    I should also note that Perl::Critic has often pushed questionable practices for the higher purpose of reducing the ways that people do things. However, those practices often cause problems, make them un-best. This is one of those cases. A more realistic best practice is to not make Perl::Critic compliance your goal. Use it where it is useful, but in cases like this, don't waste mental time on it.

提交回复
热议问题