4 unless(grep /blib/, @INC) {
8 require Config; import Config;
9 if ($] < 5.00326 || not $Config{'d_readdir'}) {
10 print "1..0 # Skip: readdir() not available\n";
15 select(STDERR); $| = 1;
16 select(STDOUT); $| = 1;
18 use IO::Dir qw(DIR_UNLINK);
24 my $not = $_[0] ? '' : 'not ';
25 print "${not}ok $tcount\n";
30 my $DIR = $^O eq 'MacOS' ? ":" : ".";
32 $dot = new IO::Dir $DIR;
36 do { $first = $dot->read } while defined($first) && $first =~ /^\./;
37 ok(+(grep { $_ eq $first } @a));
39 @b = sort($first, (grep {/^[^.]/} $dot->read));
40 ok(+(join("\0", @a) eq join("\0", @b)));
43 @c = sort grep {/^[^.]/} $dot->read;
44 ok(+(join("\0", @b) eq join("\0", @c)));
48 ok(!defined($dot->read));
50 open(FH,'>X') || die "Can't create x";
52 close(FH) or die "Can't close: $!";
54 tie %dir, IO::Dir, $DIR;
55 my @files = keys %dir;
57 # I hope we do not have an empty dir :-)
61 ok(defined($stat) && UNIVERSAL::isa($stat,'File::stat') && $stat->size == 1);
67 tie %dirx, IO::Dir, $DIR, DIR_UNLINK;
69 my $statx = $dirx{'X'};
70 ok(defined($statx) && UNIVERSAL::isa($statx,'File::stat') && $statx->size == 1);