# New Ticket Created by  Bruce Gray 
# Please include the string:  [perl #21547]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=21547 >


In config/gen/makefiles.pl, Perl is called with "inplace editing" like so:
        system("$^X -i -e 'FOO' filename");
This causes two different problems during `perl Configure.pl` on Win2000:

1) The command processor requires double quotes around the '-e' code.
Solution: The Configure::Data element PQ holds the Perl Quote needed for
the current platform, so the code becomes:
        system("$^X -i -e ${PQ}FOO${PQ} filename");

2) From perldiag:
        Can't do inplace edit without backup
        (F) You're on a system such as MS-DOS that gets confused if you try
        reading from a deleted (but still opened) file. You have to say
         -i.bak, or some such.
Win2000 has this problem, so the bare '-i' fails.
Solution: Use '-i.bak' and unlink the .bak file when done.
        system("$^X -i.bak -e ${PQ}FOO${PQ}  filename");
        unlink 'filename.bak';

This patch implements these two fixes, and reorganizes the three system
calls into one call.

Tested under Linux and Win2K (MinGW).

-- 
Hope this helps,
Bruce Gray



-- attachment  1 ------------------------------------------------------
url: http://rt.perl.org/rt2/attach/53571/40362/0085a7/inplace_edit.patch

Index: config/gen/makefiles.pl
===================================================================
RCS file: /cvs/public/parrot/config/gen/makefiles.pl,v
retrieving revision 1.14
diff -u -r1.14 makefiles.pl
--- config/gen/makefiles.pl     21 Jan 2003 10:09:58 -0000      1.14
+++ config/gen/makefiles.pl     11 Mar 2003 22:36:18 -0000
@@ -27,15 +27,22 @@
           commentType => '#');
   genfile('config/gen/makefiles/imcc.in',      'languages/imcc/Makefile',
           commentType => '#');
-  system("$^X -pi -e's/ -Wwrite-strings//'     languages/imcc/Makefile");
-  system("$^X -pi -e's/ -Wcast-qual//'                 languages/imcc/Makefile");
-  system("$^X -pi -e's/ -Wno-unused/ -Wunused/' languages/imcc/Makefile");
   genfile('config/gen/makefiles/bf.in',        'languages/bf/Makefile',
           commentType => '#');
   genfile('config/gen/makefiles/befunge.in',   'languages/befunge/Makefile',
           commentType => '#');
   genfile('config/gen/makefiles/ook.in',       'languages/ook/Makefile',
           commentType => '#');
+
+  # Change compiler flags in IMCC's makefile using inplace edit.
+  my $PQ   = Configure::Data->get('PQ');
+  my $imcc = 'languages/imcc/Makefile';
+  my $pgm  = ' s/ -Wwrite-strings//;'
+           . ' s/ -Wcast-qual//;'
+           . ' s/ -Wno-unused/ -Wunused/;';
+  system "$^X -pi.bak -e$PQ$pgm$PQ $imcc" and warn;
+  unlink "$imcc.bak" or warn;
+
 }
 
 1;

Reply via email to