home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / andere sprachen / perl5 / perl5.002 / t / lib / filehand.t < prev    next >
Encoding:
Text File  |  1996-02-12  |  626 b   |  31 lines

  1. #!./perl
  2.  
  3. BEGIN {
  4.     chdir 't' if -d 't';
  5.     @INC = '../lib';
  6.     require Config; import Config;
  7.     if ($Config{'extensions'} !~ /\bFileHandle\b/
  8.         && $Config{'osname'} ne 'VMS') {
  9.     print "1..0\n";
  10.     exit 0;
  11.     }
  12. }
  13.  
  14. use FileHandle;
  15. use strict subs;
  16.  
  17. $mystdout = new_from_fd FileHandle 1,"w";
  18. autoflush STDOUT;
  19. autoflush $mystdout;
  20. print "1..4\n";
  21.  
  22. print $mystdout "ok ",fileno($mystdout),"\n";
  23.  
  24. $fh = new FileHandle "TEST", O_RDONLY and print "ok 2\n";
  25. $buffer = <$fh>;
  26. print $buffer eq "#!./perl\n" ? "ok 3\n" : "not ok 3\n";
  27.  
  28. ungetc STDIN 65;
  29. CORE::read(STDIN, $buf,1);
  30. print $buf eq 'A' ? "ok 4\n" : "not ok 4\n";
  31.