Perl version string: why use EVAL EXPR?

后端 未结 4 2065
情话喂你
情话喂你 2020-12-16 11:29

I just took notice to this generated by Catalyst.pl. It is obviously some sort of unannotated hack. What is the advantage of setting up a version string like th

4条回答
  •  [愿得一人]
    2020-12-16 12:06

    Version numbers are complex in Perl. Here's an excellent overview for those looking for the gory details. It might surprise you how many subtle ways there are to get things wrong...

    The direct answer to your question though, is that different things expect different formats. For CPAN, you care about development versions for example, as a string. For runtime, you care about them as a number.

    Consider the case of $VERSION = "0.01_001". eval converts it to the number 0.01001 correctly.

提交回复
热议问题