I just discovered seekdir, and its kinda broken on win32 (not that I'm 100% sure of how its supposed to behave )

5.006001 seems to behave the most as I expect based on my knowledge of seek

I'm using ActivePerl/mingw-perl on WinXP

#!/usr/bin/perl -- use strict; use warnings; use Data::Dumper; use File::Temp qw/ tempdir /; print $], "\n"; my $dir = tempdir; chdir $dir or die $!; touch( qw/ hi.txt there.txt you.txt / ); opendir my($d), $dir or die $!; foreach my $ix (-1 .. 6) { printf "seekdir(%3d) = %d => %s\n", $ix, seekdir($d, $ix), DD( [ readdir $d ] ); } print '#' x 33,"\n"; sub DD { scalar Data::Dumper->new([@_])->Indent(0)->Useqq(1)->Dump ; } sub touch { for my $file ( @_ ){ open my($fh), '>', $file or die $!; close $fh; } } __END__
5.014001 seekdir( -1) = 1 => $VAR1 = []; seekdir( 0) = 1 => $VAR1 = [".","..","hi.txt","there.txt","you.txt"] +; seekdir( 1) = 1 => $VAR1 = ["","..","hi.txt","there.txt","you.txt"]; seekdir( 2) = 1 => $VAR1 = ["..","hi.txt","there.txt","you.txt"]; seekdir( 3) = 1 => $VAR1 = [".","hi.txt","there.txt","you.txt"]; seekdir( 4) = 1 => $VAR1 = ["","hi.txt","there.txt","you.txt"]; seekdir( 5) = 1 => $VAR1 = ["hi.txt","there.txt","you.txt"]; seekdir( 6) = 1 => $VAR1 = ["i.txt","there.txt","you.txt"]; ################################# 5.012002 seekdir( -1) = 1 => $VAR1 = ["",".","..","hi.txt","there.txt","you.tx +t"]; seekdir( 0) = 1 => $VAR1 = [".","..","hi.txt","there.txt","you.txt"] +; seekdir( 1) = 1 => $VAR1 = ["","..","hi.txt","there.txt","you.txt"]; seekdir( 2) = 1 => $VAR1 = ["..","hi.txt","there.txt","you.txt"]; seekdir( 3) = 1 => $VAR1 = [".","hi.txt","there.txt","you.txt"]; seekdir( 4) = 1 => $VAR1 = ["","hi.txt","there.txt","you.txt"]; seekdir( 5) = 1 => $VAR1 = ["hi.txt","there.txt","you.txt"]; seekdir( 6) = 1 => $VAR1 = ["i.txt","there.txt","you.txt"]; ################################# 5.008009 seekdir( -1) = 1 => $VAR1 = ["",".","..","hi.txt","there.txt","you.tx +t"]; seekdir( 0) = 1 => $VAR1 = [".","..","hi.txt","there.txt","you.txt"] +; seekdir( 1) = 1 => $VAR1 = ["","..","hi.txt","there.txt","you.txt"]; seekdir( 2) = 1 => $VAR1 = ["..","hi.txt","there.txt","you.txt"]; seekdir( 3) = 1 => $VAR1 = [".","hi.txt","there.txt","you.txt"]; seekdir( 4) = 1 => $VAR1 = ["","hi.txt","there.txt","you.txt"]; seekdir( 5) = 1 => $VAR1 = ["hi.txt","there.txt","you.txt"]; seekdir( 6) = 1 => $VAR1 = ["i.txt","there.txt","you.txt"]; ################################# 5.006001 seekdir( -1) = 1 => $VAR1 = [".","..","hi.txt","there.txt","you.txt"] +; seekdir( 0) = 1 => $VAR1 = [".","..","hi.txt","there.txt","you.txt"] +; seekdir( 1) = 1 => $VAR1 = ["..","hi.txt","there.txt","you.txt"]; seekdir( 2) = 1 => $VAR1 = ["hi.txt","there.txt","you.txt"]; seekdir( 3) = 1 => $VAR1 = ["there.txt","you.txt"]; seekdir( 4) = 1 => $VAR1 = ["you.txt"]; seekdir( 5) = 1 => $VAR1 = []; seekdir( 6) = 1 => $VAR1 = []; #################################

In reply to perlbug: seekdir/readdir broken on win32 on 5.008009, 5.012002, 5.014001 by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.