This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
devel/scanprov: Use library fcn to find perl versions
authorKarl Williamson <khw@cpan.org>
Sun, 28 Jul 2019 16:10:44 +0000 (10:10 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:39:32 +0000 (16:39 -0600)
(cherry picked from commit bda70fe0831788bc0acd0f681d72340bbf8a40de)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/devel/scanprov

index 1001f62..48e287f 100755 (executable)
@@ -19,14 +19,17 @@ use Getopt::Long;
 
 require './parts/ppptools.pl';
 require './parts/inc/inctools';
+require './devel/devtools.pl';
 
 our %opt = (
   mode    => 'check',
   install => '/tmp/perl/install/default',
   blead   => 'bleadperl',
+  debug   => 0,
+ 'debug-start' => "",
 );
 
-GetOptions(\%opt, qw( install=s mode=s blead=s )) or die;
+GetOptions(\%opt, qw( install=s mode=s blead=s debug debug-start=s)) or die;
 
 my $write = $opt{mode} eq 'write';
 
@@ -39,22 +42,18 @@ my @provided = grep { !exists $embed{$_} }
                map { /^(\w+)/ ? $1 : () }
                `$^X ppport.h --list-provided`;
 
-my @perls = sort { $b->{version} <=> $a->{version} }
-            map { { version => `$_ -e 'printf "%.6f", \$]'`, path => $_ } }
-            ($opt{blead}, glob "$opt{install}/*/bin/perl5.*");
-
-for (1 .. $#perls) {
-  $perls[$_]{todo} = $perls[$_-1]{version};
-}
+my $perls_ref = get_and_sort_perls(\%opt);
 
 # Get rid of blead
-shift @perls;
+shift @$perls_ref;
+
+die "Couldn't find any perls" unless @$perls_ref > 1;
 
 my %v;
 
 # We look in descending order of perl versions.  Each time through the loop
 # @provided is narrowed.
-for my $p (@perls) {
+for my $p (@$perls_ref) {
   print "checking perl $p->{version}...\n";
 
   # Get the hdr files associated with this version