This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: Inline PI function
[perl5.git] / t / io / dup.t
CommitLineData
378cc40b
LW
1#!./perl
2
79072805 3# $RCSfile: dup.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:27 $
378cc40b
LW
4
5print "1..6\n";
6
7print "ok 1\n";
8
a687059c
LW
9open(dupout,">&STDOUT");
10open(duperr,">&STDERR");
378cc40b 11
a687059c
LW
12open(STDOUT,">Io.dup") || die "Can't open stdout";
13open(STDERR,">&STDOUT") || die "Can't open stderr";
378cc40b 14
a687059c
LW
15select(STDERR); $| = 1;
16select(STDOUT); $| = 1;
378cc40b 17
a687059c
LW
18print STDOUT "ok 2\n";
19print STDERR "ok 3\n";
378cc40b
LW
20system 'echo ok 4';
21system 'echo ok 5 1>&2';
22
a687059c
LW
23close(STDOUT);
24close(STDERR);
378cc40b 25
a687059c
LW
26open(STDOUT,">&dupout");
27open(STDERR,">&duperr");
378cc40b
LW
28
29system 'cat Io.dup';
30unlink 'Io.dup';
31
a687059c 32print STDOUT "ok 6\n";