home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / PERL4036.ZIP / t / io / dup.t < prev    next >
Text File  |  1993-02-08  |  541b  |  33 lines

  1. #!./perl
  2.  
  3. # $Header: dup.t,v 4.0 91/03/20 01:50:49 lwall Locked $
  4.  
  5. print "1..6\n";
  6.  
  7. print "ok 1\n";
  8.  
  9. open(dupout,">&STDOUT");
  10. open(duperr,">&STDERR");
  11.  
  12. open(STDOUT,">Io.dup") || die "Can't open stdout";
  13. open(STDERR,">&STDOUT") || die "Can't open stderr";
  14.  
  15. select(STDERR); $| = 1;
  16. select(STDOUT); $| = 1;
  17.  
  18. print STDOUT "ok 2\n";
  19. print STDERR "ok 3\n";
  20. system 'echo ok 4';
  21. system 'echo ok 5 1>&2';
  22.  
  23. close(STDOUT);
  24. close(STDERR);
  25.  
  26. open(STDOUT,">&dupout");
  27. open(STDERR,">&duperr");
  28.  
  29. system 'cat Io.dup';
  30. unlink 'Io.dup';
  31.  
  32. print STDOUT "ok 6\n";
  33.