1#!./perl 2 3BEGIN { 4 chdir 't' if -d 't'; 5 @INC = '../lib'; 6 require Config; import Config; 7 if (not $Config{'d_readdir'}) { 8 print "1..0\n"; 9 exit 0; 10 } 11} 12 13use DirHandle; 14require './test.pl'; 15 16plan(5); 17 18$dot = new DirHandle ($^O eq 'MacOS' ? ':' : '.'); 19 20ok(defined($dot)); 21 22@a = sort <*>; 23do { $first = $dot->read } while defined($first) && $first =~ /^\./; 24ok(+(grep { $_ eq $first } @a)); 25 26@b = sort($first, (grep {/^[^.]/} $dot->read)); 27ok(+(join("\0", @a) eq join("\0", @b))); 28 29$dot->rewind; 30@c = sort grep {/^[^.]/} $dot->read; 31cmp_ok(+(join("\0", @b), 'eq', join("\0", @c))); 32 33$dot->close; 34$dot->rewind; 35ok(!defined($dot->read)); 36