This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/inc/inctools: Add function to format version
authorKarl Williamson <khw@cpan.org>
Sun, 21 Jul 2019 00:04:15 +0000 (18:04 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:39:32 +0000 (16:39 -0600)
This takes a version number and creates a floating point version with
exactly 7 digits with a decimal point after the 5.  This is used as the
first line in files in parts/todo,base, as well as in the data in
ppport.h.

(cherry picked from commit fad2103a9a2c28ff439b9b7c851a9e09194e91a6)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/parts/inc/inctools

index c78246f..528cdda 100644 (file)
@@ -57,7 +57,15 @@ sub int_parse_version
     # names in parts/todo parts/base.
 
     return 0 + join "", map { sprintf("%03d", $_) } parse_version(shift);
+}
+
+sub format_version_line
+{
+    # Returns a floating point representation of the input version
 
+    my $version = int_parse_version(shift);
+    $version =~ s/^5\B/5./;
+    return $version;
 }
 
 sub dictionary_order($$)    # Sort caselessly, ignoring punct