home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / perl / Perl / t / io / dup.t < prev    next >
Text File  |  1994-10-18  |  549b  |  33 lines

  1. #!./perl
  2.  
  3. # $RCSfile: dup.t,v $$Revision: 4.1 $$Date: 92/08/07 18:27:27 $
  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.