This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mark Perl_my_strftime with format attribute
[perl5.git] / regen / overload.pl
index fa22bd5..6d9e04d 100644 (file)
@@ -30,20 +30,20 @@ while (<DATA>) {
   push @names, $name;
 }
 
-my $c = safer_open('overload.c-new', 'overload.c');
-my $h = safer_open('overload.h-new', 'overload.h');
-mkdir("lib/overload", 0777) unless -d 'lib/overload';
-my $p = safer_open('lib/overload/numbers.pm-new', 'lib/overload/numbers.pm');
-
-
-select $p;
+my ($c, $h) = map {
+    open_new($_, '>',
+            { by => 'regen/overload.pl', file => $_, style => '*',
+              copyright => [1997, 1998, 2000, 2001, 2005 .. 2007, 2011] });
+} 'overload.c', 'overload.h';
 
-print read_only_top(lang => 'Perl', by => 'regen/overload.pl',
-                   file => 'lib/overload/numbers.pm', copyright => [2008]);
+mkdir("lib/overload", 0777) unless -d 'lib/overload';
+my $p = open_new('lib/overload/numbers.pm', '>',
+                { by => 'regen/overload.pl',
+                  file => 'lib/overload/numbers.pm', copyright => [2008] });
 
 {
 local $" = "\n    ";
-print <<"EOF";
+print $p <<"EOF";
 package overload::numbers;
 
 our \@names = qw#
@@ -60,16 +60,7 @@ our \@enums = qw#
 EOF
 }
 
-for ([$c, 'overload.c'], [$h, 'overload.h']) {
-    my ($handle, $file) = @$_;
-    print $handle read_only_top(lang => 'C', by => 'regen/overload.pl',
-                               file => $file, style => '*',
-                               copyright => [1997, 1998, 2000, 2001,
-                                            2005 .. 2007, 2011]);
-}
-
-select $h;
-print "enum {\n";
+print $h "enum {\n";
 
 for (0..$#enums) {
     my $op = $names[$_];
@@ -78,11 +69,11 @@ for (0..$#enums) {
     die if $op =~ m{\*/};
     my $l =   3 - int((length($enums[$_]) + 9) / 8);
     $l = 1 if $l < 1;
-    printf "    %s_amg,%s/* 0x%02x %-8s */\n", $enums[$_],
+    printf $h "    %s_amg,%s/* 0x%02x %-8s */\n", $enums[$_],
        ("\t" x $l), $_, $op;
 }
 
-print <<'EOF';
+print $h <<'EOF';
     max_amg_code
     /* Do not leave a trailing comma here.  C9X allows it, C89 doesn't. */
 };
@@ -207,5 +198,3 @@ concat_ass  (.=
 smart          (~~
 ftest           (-X
 regexp          (qr
-# Note: Perl_Gv_AMupdate() assumes that DESTROY is the last entry
-DESTROY                DESTROY