home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / perl / perl_1 / Perl5001 / pl / Tests / filetest < prev    next >
Encoding:
Text File  |  1996-03-04  |  2.0 KB  |  58 lines

  1. $file = 'ADFS::IDEDisc4.$.Perl.!Perl.c.acorn ';
  2. #$file = '';
  3. #$file = 'ADFS::IDEDisc4.$.Perl.pl.Tests';
  4. #$file = 'ADFS::IDEDisc4.$.Perl.pl.zero';
  5.  
  6.  
  7. print"Trying to test file $file\n\n\n";
  8.  
  9. if ( -e $file) { print("This file exists\n") ; }
  10. else { print("This file does not exist\n") ; }
  11.  
  12. if ( -z $file) { print("This file has zero size\n") ; }
  13. else { print("This file does not have zero size\n") ; }
  14.  
  15. $dummy = "A dummy line to change the stack for $file";
  16.  
  17. print"Using _, the returned size is ",( -s _),"\n";
  18. if ( -s $file) { print("This file has nonzero size\n") ; }
  19. else { print("This file does not have nonzero size\n") ; }
  20. print"The returned value is ",( -s $file),"\n";
  21.  
  22.  
  23. if ( -f $file) { print("This is a plain file\n") ; }
  24. else { print("This is not a plain file\n") ; }
  25.  
  26. if ( -d $file) { print("This is a directory\n") ; }
  27. else { print("This is not a directory\n") ; }
  28.  
  29. if ( -T $file) { print("This is a text file\n") ; }
  30. else { print("This is not a text file\n") ; }
  31.  
  32. if ( -T _) { print("Using _, this is a text file\n") ; }
  33. else { print("Using _, this is not a text file\n") ; }
  34.  
  35. if ( -B $file) { print("This is a binary file\n") ; }
  36. else { print("This is not a binary file\n") ; }
  37.  
  38.  
  39. print "M stamp:", ( -M $file), "\n";
  40. print "A stamp:", ( -A $file), "\n";
  41. print "C stamp:", ( -C $file), "\n";
  42. print "Private read    (r stamp):", ( -r $file) ? "Yes" : "No", "\n";
  43. print "Private write   (w stamp):", ( -w $file) ? "Yes" : "No", "\n";
  44. print "Private execute (x stamp):", ( -x $file) ? "Yes" : "No", "\n";
  45. print "Private owner   (o stamp):", ( -o $file) ? "Yes" : "No", "\n";
  46. print "Public read     (R stamp):", ( -R $file) ? "Yes" : "No", "\n";
  47. print "Public write    (W stamp):", ( -W $file) ? "Yes" : "No", "\n";
  48. print "Public execute  (X stamp):", ( -X $file) ? "Yes" : "No", "\n";
  49. print "Public owner    (O stamp):", ( -O $file) ? "Yes" : "No", "\n";
  50.  
  51.  
  52. print"Trying to test file $file by handle\n\n\n";
  53. open(HANDLE, $file);
  54. if ( -f HANDLE) { print("This is a file\n") ; }
  55. else { print("This is not a file\n") ; }
  56.  
  57.  
  58. print"\nDone\n";