This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Allow lvalue subs to return COWs in list context
[perl5.git] / regen_perly.pl
index 00d2a59..a96a918 100644 (file)
@@ -97,15 +97,13 @@ my ($actlines, $tablines) = extract($clines);
 
 $tablines .= make_type_tab($y_file, $tablines);
 
-my $read_only = read_only_top(lang => 'C', by => $0, from => $y_file);
+my ($act_fh, $tab_fh, $h_fh) = map {
+    open_new($_, '>', { by => $0, from => $y_file });
+} $act_file, $tab_file, $h_file;
 
-my $act_fh = safer_open("$act_file-new", $act_file);
-print $act_fh $read_only, $actlines;
-read_only_bottom_close_and_rename($act_fh);
+print $act_fh $actlines;
 
-my $tab_fh = safer_open("$tab_file-new", $tab_file);
-print $tab_fh $read_only, $tablines;
-read_only_bottom_close_and_rename($tab_fh);
+print $tab_fh $tablines;
 
 unlink $tmpc_file;
 
@@ -114,9 +112,6 @@ unlink $tmpc_file;
 # C<#line 188 "perlytmp.h"> gets picked up by make depend, so remove them.
 
 open my $tmph_fh, '<', $tmph_file or die "Can't open $tmph_file: $!\n";
-my $h_fh = safer_open("$h_file-new", $h_file);
-
-print $h_fh $read_only;
 
 my $endcore_done = 0;
 # Token macros need to be generated manually on bison 2.4
@@ -147,7 +142,9 @@ while (<$tmph_fh>) {
 close $tmph_fh;
 unlink $tmph_file;
 
-read_only_bottom_close_and_rename($h_fh);
+foreach ($act_fh, $tab_fh, $h_fh) {
+    read_only_bottom_close_and_rename($_, ['regen_perly.pl', $y_file]);
+}
 
 exit 0;