This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
integrate cfgperl contents into mainline
[perl5.git] / t / io / inplace.t
1 #!./perl
2
3 $^I = $^O eq 'VMS' ? '_bak' : '.bak';
4
5 # $RCSfile: inplace.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:29 $
6
7 print "1..2\n";
8
9 @ARGV = ('.a','.b','.c');
10 if ($^O eq 'MSWin32') {
11   $CAT = '.\perl -e "print<>"';
12   `.\\perl -le "print 'foo'" > .a`;
13   `.\\perl -le "print 'foo'" > .b`;
14   `.\\perl -le "print 'foo'" > .c`;
15 }
16 elsif ($^O eq 'VMS') {
17   $CAT = 'MCR []perl. -e "print<>"';
18   `MCR []perl. -le "print 'foo'" > ./.a`;
19   `MCR []perl. -le "print 'foo'" > ./.b`;
20   `MCR []perl. -le "print 'foo'" > ./.c`;
21 }
22 else {
23   $CAT = 'cat';
24   `echo foo | tee .a .b .c`;
25 }
26 while (<>) {
27     s/foo/bar/;
28 }
29 continue {
30     print;
31 }
32
33 if (`$CAT .a .b .c` eq "bar\nbar\nbar\n") {print "ok 1\n";} else {print "not ok 1\n";}
34 if (`$CAT .a$^I .b$^I .c$^I` eq "foo\nfoo\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";}
35
36 unlink '.a', '.b', '.c', ".a$^I", ".b$^I", ".c$^I";