At minimum, it doesn't provide a valid lstat on directories immediately below the search root:

# file `perl -MFile::Find -e'$File::Find::dont_use_nlink = 1; find(sub + { lstat _ or print "$File::Find::name\n"; -l "" }, "/tmp")'` /tmp/opt: directory /tmp/hsperfdata_ammon: directory /tmp/.ICE-unix: sticky directory /tmp/xmmskde: directory /tmp/gpg-SRkPcN: directory /tmp/kde-root: directory /tmp/0165158219: directory /tmp/gconfd-root: directory /tmp/scrollkeeper-root: directory /tmp/hsperfdata_root: directory /tmp/gpg-ZV9kSX: directory /tmp/kde-steve: directory /tmp/ksocket-root: directory /tmp/gpg-h5tTLO: directory /tmp/1051437914: directory /tmp/gpg-I5lCsj: directory /tmp/.X11-unix: sticky directory /tmp/orbit-root: directory

(Of course, if your system equates lstat "" with lstat ".", you'll need to -l a non-existing file to clear _.)

In the above example, there are sub-trees below some of those directories listed, and they do have a valid stat cache. I don't know, off hand, if there are any links in /tmp at the moment, so I can't say how symlinks are handled.

I should note that this test is using File::Find version 1.07, which is a bit behind what's available on CPAN, but I don't recall the newer version behaving any different when I tested it.

At any rate, the custom module I wrote ended up being 50% faster than File::Find, when tested on the 30K file tree mentioned in the original post, and the same speed as File::Find on very small trees. Best of all, though? It does exactly what I need. :)


In reply to Re^4: Can the special underline filehandle (stat cache) be cleared? (when) by ammon
in thread Can the special underline filehandle (stat cache) be cleared? by ammon

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.