Commit | Line | Data |
2d259d92 |
1 | #!./perl |
2 | |
3 | $^I = 'bak*'; |
4 | |
5 | # Modified from the original inplace.t to test adding prefixes |
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 | } |
2986a63f |
16 | elsif ($^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 | } |
e46ffa55 |
22 | elsif ($^O eq 'VMS') { |
23 | $CAT = 'MCR []perl. -e "print<>"'; |
24 | `MCR []perl. -le "print 'foo'" > ./.a`; |
25 | `MCR []perl. -le "print 'foo'" > ./.b`; |
26 | `MCR []perl. -le "print 'foo'" > ./.c`; |
27 | } |
dc459aad |
28 | elsif ($^O eq 'MacOS') { |
29 | $CAT = "$^X -e \"print<>\""; |
30 | `$^X -le "print 'foo'" > .a`; |
31 | `$^X -le "print 'foo'" > .b`; |
32 | `$^X -le "print 'foo'" > .c`; |
33 | } |
2d259d92 |
34 | else { |
35 | $CAT = 'cat'; |
36 | `echo foo | tee .a .b .c`; |
37 | } |
38 | while (<>) { |
39 | s/foo/bar/; |
40 | } |
41 | continue { |
42 | print; |
43 | } |
44 | |
45 | if (`$CAT .a .b .c` eq "bar\nbar\nbar\n") {print "ok 1\n";} else {print "not ok 1\n";} |
46 | if (`$CAT bak.a bak.b bak.c` eq "foo\nfoo\nfoo\n") {print "ok 2\n";} else {print "not ok 2\n";} |
47 | |
48 | unlink '.a', '.b', '.c', 'bak.a', 'bak.b', 'bak.c'; |