Hi, Tony Cook via RT wrote: > > On Wed, 13 Mar 2019 15:21:38 -0700, mark.maimone@jpl.nasa.gov wrote: > > I noticed a disconnect between Find::File documentation and > > implementation. It claims that "follow" and "preprocess" options can > > be used independently, but if I invoke Find::Find's "find()" using > > options that include "follow"ing symlinks, it never invokes the > > corresponding "preprocess" coderef option. Looking at the Find.pm > > source, it's clear that only _find_dir() ever invokes "preprocess" > > (via local $pre_process); _find_dir_symlink() (which is called instead > > of _find_dir() when "follow" is set) never invokes it at all. > > The documentation for File::Find states: > > =3Ditem C<preprocess> > =20 > ... When > I<follow> or I<follow_fast> are in effect, C<preprocess> is a no-op. > > This text was added in perl-5.6.0-4056-g7e47e6ffb6 (in 2001) > > Could you please quote the text that indicates they are independent? Mea culpa, I see that now. I must've just read the "follow" text closely, which doesn't mention it. Maybe if the words "I<follow>" and "I<follow_fast>" in that paragraph had the same emphasis as "C<preprocsss>" it'd be even more obvious? Your quote shows them as italic, which renders as plain text in my terminal, whereas C<> shows up in double quotes. > > >=20 > > I was able to make things work (obeying "preprocess" hooks > > regardless of whether "follow" is also set) by duplicating the > > _find_dir() code in _find_dir_symlink(), adding the third line here: > >=20 > > @filenames =3D readdir DIR; > > closedir(DIR); > > @filenames =3D $pre_process->(@filenames) if $pre_process; > >=20 > > I would like to suggest including this or a similar change in > > new releases of File::Find.pm > > That said, we could possibly allow preprocess to work with follow, but it's= > an enhancement, not a bug fix. Understood. It does seem like a helpful and simple fix, it'd be a nice enhancement. I have a filesystem with lots of symlinks, and I found I wasn't able to get the search to terminate in a reasonable amount of time unless I took advantage of the "preprocess" hook to prune away unneeded search branches. Thanks much for your reply! Mark M. -- ------------------------------------------------------------------------------ Mark Maimone cell : +1 (818) 642 - 7334 NASA Jet Propulsion Lab, Caltech fax: +1 (818) 393 - 2346 http://www-robotics.jpl.nasa.gov/people/Mark_Maimone