Author: kwilliams
Date: Sat Apr 19 20:23:29 2008
New Revision: 11119

Modified:
   ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Base.pm
   ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Platform/Windows.pm

Log:
Use IO::File instead of barewords

Modified: ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Base.pm
==============================================================================
--- ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Base.pm       (original)
+++ ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Base.pm       Sat Apr 19 
20:23:29 2008
@@ -6,6 +6,7 @@
 use Cwd ();
 use Config;
 use Text::ParseWords;
+use IO::File;
 
 use vars qw($VERSION);
 $VERSION = '0.2201';
@@ -118,10 +119,8 @@
   
   my $tmpfile = File::Spec->catfile(File::Spec->tmpdir, 'compilet.c');
   {
-    local *FH;
-    open FH, "> $tmpfile" or die "Can't create $tmpfile: $!";
-    print FH "int boot_compilet() { return 1; }\n";
-    close FH;
+    my $FH = IO::File->new("> $tmpfile") or die "Can't create $tmpfile: $!";
+    print $FH "int boot_compilet() { return 1; }\n";
   }
 
   my ($obj_file, @lib_files);

Modified: ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Platform/Windows.pm
==============================================================================
--- ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Platform/Windows.pm   
(original)
+++ ExtUtils-CBuilder/trunk/lib/ExtUtils/CBuilder/Platform/Windows.pm   Sat Apr 
19 20:23:29 2008
@@ -7,6 +7,7 @@
 use File::Spec;
 
 use ExtUtils::CBuilder::Base;
+use IO::File;
 
 use vars qw($VERSION @ISA);
 $VERSION = '0.2201';
@@ -292,18 +293,16 @@
   $self->add_to_cleanup($script);
   print "Generating script '$script'\n" if !$self->{quiet};
 
-  open( SCRIPT, ">$script" )
+  my $SCRIPT = IO::File->new( ">$script" )
     or die( "Could not create script '$script': $!" );
 
-  print SCRIPT join( "\n",
+  print $SCRIPT join( "\n",
     map { ref $_ ? @{$_} : $_ }
     grep defined,
     delete(
       @spec{ qw(includes cflags optimize defines perlinc) } )
   );
 
-  close SCRIPT;
-
   push @{$spec{includes}}, '@"' . $script . '"';
 
   return %spec;
@@ -365,10 +364,10 @@
 
   print "Generating script '$script'\n" if !$self->{quiet};
 
-  open( SCRIPT, ">$script" )
+  my $SCRIPT = IO::File->new( ">$script" )
     or die( "Could not create script '$script': $!" );
 
-  print SCRIPT join( "\n",
+  print $SCRIPT join( "\n",
     map { ref $_ ? @{$_} : $_ }
     grep defined,
     delete(
@@ -377,8 +376,6 @@
                 def_file implib map_file)            } )
   );
 
-  close SCRIPT;
-
   push @{$spec{lddlflags}}, '@"' . $script . '"';
 
   return %spec;
@@ -422,7 +419,7 @@
 
   print "Generating script '$script'\n" if !$self->{quiet};
 
-  open( SCRIPT, ">$script" )
+  my $SCRIPT = IO::File->new( ">$script" )
     or die( "Could not create script '$script': $!" );
 
   # XXX Borland "response files" seem to be unable to accept macro
@@ -430,15 +427,13 @@
   # backslash doesn't work, and any level of quotes are stripped. The
   # result is is a floating point number in the source file where a
   # string is expected. So we leave the macros on the command line.
-  print SCRIPT join( "\n",
+  print $SCRIPT join( "\n",
     map { ref $_ ? @{$_} : $_ }
     grep defined,
     delete(
       @spec{ qw(includes cflags optimize perlinc) } )
   );
 
-  close SCRIPT;
-
   push @{$spec{includes}}, '@"' . $script . '"';
 
   return %spec;
@@ -488,29 +483,25 @@
   print "Generating scripts '$ld_script' and '$ld_libs'.\n" if !$self->{quiet};
 
   # Script 1: contains options & names of object files.
-  open( LD_SCRIPT, ">$ld_script" )
+  my $LD_SCRIPT = IO::File->new( ">$ld_script" )
     or die( "Could not create linker script '$ld_script': $!" );
 
-  print LD_SCRIPT join( " +\n",
+  print $LD_SCRIPT join( " +\n",
     map { @{$_} }
     grep defined,
     delete(
       @spec{ qw(lddlflags libpath other_ldflags startup objects) } )
   );
 
-  close LD_SCRIPT;
-
   # Script 2: contains name of libs to link against.
-  open( LD_LIBS, ">$ld_libs" )
+  my $LD_LIBS = IO::File->new( ">$ld_libs" )
     or die( "Could not create linker script '$ld_libs': $!" );
 
-  print LD_LIBS join( " +\n",
+  print $LD_LIBS join( " +\n",
      (delete $spec{libperl}  || ''),
     @{delete $spec{perllibs} || []},
   );
 
-  close LD_LIBS;
-
   push @{$spec{lddlflags}}, '@"' . $ld_script  . '"';
   push @{$spec{perllibs}},  '@"' . $ld_libs    . '"';
 
@@ -632,32 +623,30 @@
 
   print "Generating script '$script'\n" if !$self->{quiet};
 
-  open( SCRIPT, ">$script" )
+  my $SCRIPT = IO::File->new( ">$script" )
     or die( "Could not create script '$script': $!" );
 
-  print( SCRIPT 'SEARCH_DIR(' . $_ . ")\n" )
+  print $SCRIPT ( 'SEARCH_DIR(' . $_ . ")\n" )
     for @{delete $spec{libpath} || []};
 
   # gcc takes only one startup file, so the first object in startup is
   # specified as the startup file and any others are shifted into the
   # beginning of the list of objects.
   if ( $spec{startup} && @{$spec{startup}} ) {
-    print SCRIPT 'STARTUP(' . shift( @{$spec{startup}} ) . ")\n";
+    print $SCRIPT 'STARTUP(' . shift( @{$spec{startup}} ) . ")\n";
     unshift @{$spec{objects}},
       @{delete $spec{startup} || []};
   }
 
-  print SCRIPT 'INPUT(' . join( ',',
+  print $SCRIPT 'INPUT(' . join( ',',
     @{delete $spec{objects}  || []}
   ) . ")\n";
 
-  print SCRIPT 'INPUT(' . join( ' ',
+  print $SCRIPT 'INPUT(' . join( ' ',
      (delete $spec{libperl}  || ''),
     @{delete $spec{perllibs} || []},
   ) . ")\n";
 
-  close SCRIPT;
-
   push @{$spec{other_ldflags}}, '"' . $script . '"';
 
   return %spec;

Reply via email to