This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
basic.t: Provide descriptions for all unit tests
[perl5.git] / regen / regcomp.pl
index 9890a1a..ffb7d7a 100644 (file)
@@ -20,7 +20,7 @@
 
 BEGIN {
     # Get function prototypes
-    require 'regen/regen_lib.pl';
+    require './regen/regen_lib.pl';
 }
 use strict;
 
@@ -126,7 +126,8 @@ sub parse_opcode_def {
     # the content of the "desc" field from the first step is extracted here:
     @{$node}{qw(type code args flags longj)}= split /[,\s]\s*/, $node->{desc};
 
-    $node->{$_} //= "" for qw(type code args flags longj);
+    defined $node->{$_} or $node->{$_} = ""
+        for qw(type code args flags longj);
 
     register_node($node); # has to be before the type_alias code below
 
@@ -612,7 +613,7 @@ format GuTS =
  ^*~~
  \$node->{pod_comment}
  ^$name_fmt ^<<<<<<<<< ^$descr_fmt~~
- \$node->{name}, \$code, \$node->{comment}//''
+ \$node->{name}, \$code, defined \$node->{comment} ? \$node->{comment} : ''
 .
 1;
 EOD
@@ -620,7 +621,7 @@ EOD
     my $old_fh= select($guts);
     $~= "GuTS";
 
-    open my $oldguts, "pod/perldebguts.pod"
+    open my $oldguts, '<', 'pod/perldebguts.pod'
         or die "$0 cannot open pod/perldebguts.pod for reading: $!";
     while (<$oldguts>) {
         print;
@@ -648,7 +649,8 @@ END_OF_DESCR
     while (<$oldguts>) {
         last if /=for regcomp.pl end/;
     }
-    do { print } while <$oldguts>;
+    do { print } while <$oldguts>; #win32 can't unlink an open FH
+    close $oldguts or die "Error closing pod/perldebguts.pod: $!";
     select $old_fh;
     close_and_rename($guts);
 }