The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl -w
################################################################################
#
#  mktodo -- generate baseline and todo files by running mktodo.pl
#
################################################################################
#
#  Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
#  Version 2.x, Copyright (C) 2001, Paul Marquess.
#  Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
#
#  This program is free software; you can redistribute it and/or
#  modify it under the same terms as Perl itself.
#
################################################################################

use strict;
use Getopt::Long;

require 'devel/devtools.pl';

our %opt = (
  base    => 0,
  check   => 1,
  verbose => 0,
  install => '/tmp/perl/install/default',
  blead   => 'bleadperl-debug',
);

GetOptions(\%opt, qw( base check! verbose install=s blead=s blead-version=s )) or die;

identify();

my $outdir = 'parts/todo';

my @perls = sort { $b->{version} <=> $a->{version} }
            map { { version => `$_ -e 'printf "%.6f", \$]'`, path => $_ } }
            ($opt{blead}, grep !/-RC\d+/, glob "$opt{install}/*/bin/perl5.*");

if (exists $opt{'blead-version'}) {
  $perls[0]{version} = $opt{'blead-version'};
}

for (1 .. $#perls) {
  $perls[$_]{todo} = $perls[$_-1]{version};
}

shift @perls;

for (@perls) {
  my $todo = do { my $v = $_->{todo}; $v =~ s/\D+//g; $v };
  -e "$outdir/$todo" and next;
  my @args = ('--perl', $_->{path}, '--todo', "$outdir/$todo", '--version', "$_->{todo}");
  push @args, '--base' if $opt{base};
  push @args, '--verbose' if $opt{verbose};
  push @args, '--nocheck' unless $opt{check};
  runperl('devel/mktodo.pl', @args) or die "error running mktodo.pl [$!] [$?]\n";
}