This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
devel/mktodo.pl: Put hash lookups in variables
authorKarl Williamson <khw@cpan.org>
Sat, 24 Aug 2019 21:03:20 +0000 (15:03 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:39:31 +0000 (16:39 -0600)
Looked up once, and easier to read.

(cherry picked from commit 04d3d1b8c41271de1940e81ae3a516e229e2e434)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/devel/mktodo.pl

index 9fc49ec..a407de5 100644 (file)
@@ -42,6 +42,13 @@ perl=s todo=s blead version=s shlib=s debug base verbose check!
 
 identify();
 
+my $todo_file;
+my $todo_version;
+if ($opt{todo}) {
+    $todo_file = $opt{todo};
+    $todo_version = $opt{version};
+}
+
 print "\n", ident_str(), "\n\n";
 
 my $fullperl = `which $opt{perl}`;
@@ -86,7 +93,7 @@ keys %sym >= 50 or die "less than 50 symbols found in $fullperl\n";
 # }
 #
 # The values are the outputs from nm, plus 'E' from us, for Error
-my %todo = %{load_todo($opt{todo}, $opt{version})} if $opt{todo};
+my %todo = %{load_todo($todo_file, $todo_version)} if $opt{todo};
 
 my @recheck;
 
@@ -242,7 +249,7 @@ retry:
 
   # Write the revised todo, so that apicheck.c when generated in the next
   # iteration will have these #ifdef'd out
-  write_todo($opt{todo}, $opt{version}, \%todo);
+  write_todo($todo_file, $todo_version, \%todo);
 } # End of loop
 
 # If we are to check our work, do so.  This verifies that each symbol
@@ -270,7 +277,7 @@ if ($opt{check}) {
 
     # Write out the todo file without this symbol, meaning it will be enabled
     # in the generated apicheck.c file
-    write_todo($opt{todo}, $opt{version}, \%todo);
+    write_todo($todo_file, $todo_version, \%todo);
 
     # E is not an nm symbol, but was added by us to indicate 'Error'
     if ($cur eq "E (Perl_$sym)") {
@@ -323,7 +330,7 @@ if ($opt{check}) {
   }
 } # End of checking our work
 
-write_todo($opt{todo}, $opt{version}, \%todo);
+write_todo($todo_file, $todo_version, \%todo);
 
 # Clean up after ourselves
 run(qw(make realclean));
@@ -342,7 +349,7 @@ sub display_sym
   $what = colored("$what symbol", $col{$what});
 
   printf "[%s] %s %-30s # %s%s\n",
-         $opt{version}, $what, $sym, $reason, $extra;
+         $todo_version, $what, $sym, $reason, $extra;
 }
 
 sub regen_Makefile
@@ -505,7 +512,7 @@ sub get_apicheck_symbol_map
       }
 
       # And rewrite the todo file, including these new symbols.
-      write_todo($opt{todo}, $opt{version}, \%todo);
+      write_todo($todo_file, $todo_version, \%todo);
 
       # Regenerate apicheck.c for the next iteration
       regen_apicheck();