4 unless(grep /blib/, @INC) {
6 @INC = '../lib' if -d '../lib';
8 require Config; import Config;
9 if ($] < 5.00326 || not $Config{'d_readdir'}) {
15 select(STDERR); $| = 1;
16 select(STDOUT); $| = 1;
18 use IO::Dir qw(DIR_UNLINK);
22 $dot = new IO::Dir ".";
23 print defined($dot) ? "ok" : "not ok", " 1\n";
26 do { $first = $dot->read } while defined($first) && $first =~ /^\./;
27 print +(grep { $_ eq $first } @a) ? "ok" : "not ok", " 2\n";
29 @b = sort($first, (grep {/^[^.]/} $dot->read));
30 print +(join("\0", @a) eq join("\0", @b)) ? "ok" : "not ok", " 3\n";
33 @c = sort grep {/^[^.]/} $dot->read;
34 print +(join("\0", @b) eq join("\0", @c)) ? "ok" : "not ok", " 4\n";
38 print defined($dot->read) ? "not ok" : "ok", " 5\n";
40 open(FH,'>X') || die "Can't create x";
44 tie %dir, IO::Dir, ".";
45 my @files = keys %dir;
47 # I hope we do not have an empty dir :-)
48 print @files ? "ok" : "not ok", " 6\n";
51 print defined($stat) && UNIVERSAL::isa($stat,'File::stat') && $stat->size == 1
52 ? "ok" : "not ok", " 7\n";
56 print -f 'X' ? "ok" : "not ok", " 8\n";
58 tie %dirx, IO::Dir, ".", DIR_UNLINK;
60 my $statx = $dirx{'X'};
61 print defined($statx) && UNIVERSAL::isa($statx,'File::stat') && $statx->size == 1
62 ? "ok" : "not ok", " 9\n";
66 print -f 'X' ? "not ok" : "ok", " 10\n";