source: trunk/essentials/dev-lang/perl/t/io/inplace.t

Last change on this file was 3181, checked in by bird, 18 years ago

perl 5.8.8

File size: 1.1 KB
Line 
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
7print "1..2\n";
8
9@ARGV = ('.a','.b','.c');
10if ($^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}
16elsif ($^O eq 'NetWare') {
17 $CAT = 'perl -e "print<>"';
18 `perl -le "print 'foo'" > .a`;
19 `perl -le "print 'foo'" > .b`;
20 `perl -le "print 'foo'" > .c`;
21}
22elsif ($^O eq 'MacOS') {
23 $CAT = "$^X -e \"print<>\"";
24 `$^X -le "print 'foo'" > .a`;
25 `$^X -le "print 'foo'" > .b`;
26 `$^X -le "print 'foo'" > .c`;
27}
28elsif ($^O eq 'VMS') {
29 $CAT = 'MCR []perl. -e "print<>"';
30 `MCR []perl. -le "print 'foo'" > ./.a`;
31 `MCR []perl. -le "print 'foo'" > ./.b`;
32 `MCR []perl. -le "print 'foo'" > ./.c`;
33}
34else {
35 $CAT = 'cat';
36 `echo foo | tee .a .b .c`;
37}
38while (<>) {
39 s/foo/bar/;
40}
41continue {
42 print;
43}
44
45if (`$CAT .a .b .c` eq "bar\nbar\nbar\n") {print "ok 1\n";} else {print "not ok 1\n";}
46if (`$CAT .a$^I .b$^I .c$^I` eq "foo\nfoo\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";}
47
48unlink '.a', '.b', '.c', ".a$^I", ".b$^I", ".c$^I";
Note: See TracBrowser for help on using the repository browser.