Author: paultcochrane
Date: Mon Jun  4 13:24:05 2007
New Revision: 18809

Modified:
   trunk/t/compilers/imcc/syn/file.t
   trunk/t/compilers/imcc/syn/macro.t
   trunk/t/compilers/imcc/syn/pod.t
   trunk/t/examples/shootout.t
   trunk/t/pmc/os.t

Log:
[t] Replaced bareword filehandles with variables as per coding standards


Modified: trunk/t/compilers/imcc/syn/file.t
==============================================================================
--- trunk/t/compilers/imcc/syn/file.t   (original)
+++ trunk/t/compilers/imcc/syn/file.t   Mon Jun  4 13:24:05 2007
@@ -27,11 +27,11 @@
 my $PERL5  = $PConfig{perl};
 
 ##############################
-open FOO, ">", "temp.pasm" or die "Can't write temp.pasm\n";
-print FOO <<'ENDF';
+open my $FOO, ">", "temp.pasm" or die "Can't write temp.pasm\n";
+print $FOO <<'ENDF';
   .constant BAR 42
 ENDF
-close FOO;
+close $FOO;
 
 pir_output_is( <<'CODE', <<'OUT', "include pasm" );
 .sub test :main
@@ -49,11 +49,11 @@
 unlink "temp.pasm";
 
 ##############################
-open FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
-print FOO <<'ENDF';
+open $FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
+print $FOO <<'ENDF';
   .const int BAR = 42
 ENDF
-close FOO;
+close $FOO;
 
 pir_output_is( <<'CODE', <<'OUT', "include pir" );
 .sub test :main
@@ -71,11 +71,11 @@
 unlink "temp.pir";
 
 ##############################
-open FOO, ">", "temp.inc" or die "Can't write temp.inc\n";
-print FOO <<'ENDF';
+open $FOO, ">", "temp.inc" or die "Can't write temp.inc\n";
+print $FOO <<'ENDF';
   .const int BAR = 42
 ENDF
-close FOO;
+close $FOO;
 
 pir_output_is( <<'CODE', <<'OUT', "include .inc" );
 .sub test :main
@@ -94,8 +94,8 @@
 
 ##############################
 my $file = '_test.inc';
-open F, ">", "$file";
-print F <<'EOF';
+open my $F, ">", "$file";
+print $F <<'EOF';
 .sub _foo              # sub foo(int a, int b)
    .param int a
    .param int b
@@ -112,7 +112,7 @@
    .return (pl, mi)
 .end
 EOF
-close F;
+close $F;
 
 pir_output_is( <<'CODE', <<'OUT', "subroutine in external file" );
 .sub test :main
@@ -143,14 +143,14 @@
 # test load_bytecode branches and subs
 
 # write sub2
-open FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
-print FOO <<'ENDF';
+open $FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
+print $FOO <<'ENDF';
 .pcc_sub _sub2
     print "sub2\n"
     end
 .end
 ENDF
-close FOO;
+close $FOO;
 
 # compile it
 
@@ -175,8 +175,8 @@
 OUT
 
 # write sub2
-open FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
-print FOO <<'ENDF';
+open $FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
+print $FOO <<'ENDF';
 .pcc_sub _sub2
     print "sub2\n"
    .pcc_begin_return
@@ -184,7 +184,7 @@
     end
 .end
 ENDF
-close FOO;
+close $FOO;
 
 # compile it
 
@@ -211,8 +211,8 @@
 OUT
 
 # write sub2
-open FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
-print FOO <<'ENDF';
+open $FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
+print $FOO <<'ENDF';
 .pcc_sub _not_sub2
     print "not sub2\n"
     end
@@ -223,7 +223,7 @@
     end
 .end
 ENDF
-close FOO;
+close $FOO;
 
 # compile it
 
@@ -248,8 +248,8 @@
 OUT
 
 # write sub2
-open FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
-print FOO <<'ENDF';
+open $FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
+print $FOO <<'ENDF';
 .pcc_sub _sub2
     print "sub2\n"
    .pcc_begin_return
@@ -257,7 +257,7 @@
     end
 .end
 ENDF
-close FOO;
+close $FOO;
 
 # compile it
 
@@ -306,8 +306,8 @@
 OUT
 
 # write subs
-open FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
-print FOO <<'ENDF';
+open $FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
+print $FOO <<'ENDF';
 .pcc_sub _sub1
     print "sub1\n"
     $P0 = global "_sub2"
@@ -326,7 +326,7 @@
     end
 .end
 ENDF
-close FOO;
+close $FOO;
 
 # compile it
 
@@ -344,8 +344,8 @@
     # include a non-existent file and catch the error message
     my $err_msg;
     {
-        open FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
-        print FOO << 'END_PIR';
+        open $FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
+        print $FOO <<'END_PIR';
 # Including a non-existent file should produce an error
 .include "non_existent.pir"
 # An error should have been raised
@@ -354,14 +354,14 @@
   end
 .end
 END_PIR
-        close FOO;
+        close $FOO;
         local *OLDERR;
         open OLDERR, ">&", "STDERR"   or die "Can't save STDERR\n";
         open STDERR, ">",  "temp.out" or die "Can't write temp.out\n";
         system "$PARROT temp.pir";
-        open FOO, "<", "temp.out" or die "Can't read temp.out\n";
-        { local $/; $err_msg = <FOO>; }
-        close FOO;
+        open $FOO, "<", "temp.out" or die "Can't read temp.out\n";
+        { local $/; $err_msg = <$FOO>; }
+        close $FOO;
         open STDERR, ">&", "OLDERR" or die "Can't restore STDERR\n";
         unlink "temp.out";
     }
@@ -369,10 +369,10 @@
     # read a non-existent file and catch the error message
     my $enoent_err_msg;
     {
-        open FOO, "<", "non_existent.file";
+        open $FOO, "<", "non_existent.file";
         my $ENOENT = $! + 0;
-        open FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
-        print FOO << "END_PIR";
+        open $FOO, ">", "temp.pir" or die "Can't write temp.pir\n";
+        print $FOO <<"END_PIR";
 .sub test \:main
   # run a OS command, and get the errmessge for the exit code
   .local string enoent_err_msg
@@ -381,7 +381,7 @@
   end
 .end
 END_PIR
-        close FOO;
+        close $FOO;
         $enoent_err_msg = qx{$PARROT temp.pir}
     }
 

Modified: trunk/t/compilers/imcc/syn/macro.t
==============================================================================
--- trunk/t/compilers/imcc/syn/macro.t  (original)
+++ trunk/t/compilers/imcc/syn/macro.t  Mon Jun  4 13:24:05 2007
@@ -157,11 +157,11 @@
   end
 CODE
 
-open FOO, '>', 'macro.tempfile';
-print FOO <<'ENDF';
+open my $FOO, '>', 'macro.tempfile';
+print $FOO <<'ENDF';
   set S0, "Betelgeuse\n"
 ENDF
-close FOO;
+close $FOO;
 
 pasm_output_is( <<'CODE', <<'OUTPUT', 'basic include macro' );
 .include "macro.tempfile"
@@ -176,8 +176,8 @@
 Betelgeuse
 OUTPUT
 
-open FOO, '>', 'macro.tempfile';    # Clobber previous
-print FOO <<'ENDF';
+open $FOO, '>', 'macro.tempfile';    # Clobber previous
+print $FOO <<'ENDF';
 .macro multiply(A,B)
     new P0, .Float
     set P0, .A
@@ -187,7 +187,7 @@
     mul P2, P1, P0
 .endm
 ENDF
-close FOO;
+close $FOO;
 
 pasm_output_is( <<'CODE', <<'OUTPUT', 'include a file defining a macro' );
 .include "macro.tempfile"

Modified: trunk/t/compilers/imcc/syn/pod.t
==============================================================================
--- trunk/t/compilers/imcc/syn/pod.t    (original)
+++ trunk/t/compilers/imcc/syn/pod.t    Mon Jun  4 13:24:05 2007
@@ -52,15 +52,15 @@
 ok
 OUT
 
-open FOO, ">", "include.tempfile";
-print FOO <<'ENDF';
+open my $FOO, ">", "include.tempfile";
+print $FOO <<'ENDF';
 
 =head1 Foobar
 
 we don't cut out!!!
 
 ENDF
-close FOO;
+close $FOO;
 
 SKIP: {
     skip( "Closing out of pod from included files", 1 );

Modified: trunk/t/examples/shootout.t
==============================================================================
--- trunk/t/examples/shootout.t (original)
+++ trunk/t/examples/shootout.t Mon Jun  4 13:24:05 2007
@@ -69,9 +69,9 @@
     my $file = "$DIR/$script";
 
     # parse first line
-    open( FILE, '<', $file ) or die "unable to open file [$file] : $!";
-    my $shebang = <FILE>;
-    close FILE;
+    open( my $FILE, '<', $file ) or die "unable to open file [$file] : $!";
+    my $shebang = <$FILE>;
+    close $FILE;
     my $expected = slurp_file("$file$EXT");
 
     my $args = "";

Modified: trunk/t/pmc/os.t
==============================================================================
--- trunk/t/pmc/os.t    (original)
+++ trunk/t/pmc/os.t    Mon Jun  4 13:24:05 2007
@@ -197,9 +197,9 @@
 SKIP: {
     skip 'not implemented on windows yet', 1 if ( $MSWin32 && $MSVC );
 
-    opendir IN, '.';
-    my @entries = readdir IN;
-    closedir IN;
+    opendir my $IN, '.';
+    my @entries = readdir $IN;
+    closedir $IN;
     my $entries = join( ' ', @entries ) . "\n";
     pir_output_is( <<'CODE', $entries, 'Test OS.readdir' );
 .sub main :main
@@ -215,8 +215,8 @@
 
 # test rename
 SKIP: {
-    open FILE, ">", "____some_test_file";
-    close FILE;
+    open my $FILE, ">", "____some_test_file";
+    close $FILE;
     pir_output_is( <<'CODE', <<"OUT", 'Test OS.rename' );
 .sub main :main
     $P1 = new .OS

Reply via email to