This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
parts/inc/inctools: Add fcn to return integer version
authorKarl Williamson <khw@cpan.org>
Sat, 20 Jul 2019 23:22:36 +0000 (17:22 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:39:30 +0000 (16:39 -0600)
This is a Perl version of the C macro PERL_BCDVERSION, so the value
returned can be used  as the file names in parts/base and parts/todo,
and is easy to compare.

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

index 653886b..7ac26bd 100644 (file)
@@ -51,7 +51,12 @@ sub parse_version
   die "Invalid version number format: '$ver'$mesg\n";
 }
 
+sub int_parse_version
+{
+    # Returns integer 7 digit human-readable version, suitable for use in file
+    # names in parts/todo parts/base.
 
+    return 0 + join "", map { sprintf("%03d", $_) } parse_version(shift);
 
 }