home *** CD-ROM | disk | FTP | other *** search
/ Freelog 15 / FREELOG 15.ISO / WebMaster / Perl / PERL5106.ZIP / perl5 / ntt / Op / readdir.ntt < prev    next >
Encoding:
Text File  |  1995-11-07  |  988 b   |  40 lines

  1. #!./perl
  2.  
  3. eval 'opendir(NOSUCH, "no/such/directory");';
  4. if ($@) { print "1..0\n"; exit; }
  5.  
  6. print "1..3\n";
  7.  
  8. if (opendir(OP, "op")) { print "ok 1\n"; } else { print "not ok 1\n"; }
  9.  
  10. # WYT 1995-05-02 converted from .t to .ntt extensions
  11. #@D = grep(/^[^\.].*\.t$/i, readdir(OP));
  12. @D = grep(/^[^\.].*\.ntt$/i, readdir(OP));
  13.  
  14. closedir(OP);
  15.  
  16. if (@D > 20 && @D < 100) { print "ok 2\n"; } else { print "not ok 2\n"; }
  17.  
  18. @R = sort @D;
  19.  
  20. # WYT 1995-05-02
  21. #@G = <op/*.t>;
  22. @G = <op/*.ntt>;
  23.  
  24. # WYT 1995-05-02
  25. #if ($G[0] =~ m#.*\](\w+\.t)#i) {
  26. if ($G[0] =~ m#.*\](\w+\.ntt)#i) {
  27.  
  28.     # grep is to convert filespecs returned from glob under VMS to format
  29.     # identical to that returned by readdir
  30.  
  31. # WYT 1995-05-02
  32. #    @G = grep(s#.*\](\w+\.t).*#op/$1#i,<op/*.t>);
  33.     @G = grep(s#.*\](\w+\.ntt).*#op/$1#i,<op/*.ntt>);
  34. }
  35. while (@R && @G && "op/".$R[0] eq $G[0]) {
  36.     shift(@R);
  37.     shift(@G);
  38. }
  39. if (@R == 0 && @G == 0) { print "ok 3\n"; } else { print "not ok 3\n"; }
  40.