develooper Front page | perl.perl5.porters | Postings from March 2019

[perl #133931] File::Find find() with "follow" option fails toinvoke "preprocess"

Tony Cook via RT
March 19, 2019 00:23
[perl #133931] File::Find find() with "follow" option fails toinvoke "preprocess"
Message ID:
On Wed, 13 Mar 2019 15:21:38 -0700, 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
> 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:

  =item C<preprocess>
  ...  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?

> 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:
> @filenames = readdir DIR;
> closedir(DIR);
> @filenames = $pre_process->(@filenames) if $pre_process;
> I would like to suggest including this or a similar change in
> new releases of

That said, we could possibly allow preprocess to work with follow, but it's an enhancement, not a bug fix.


via perlbug:  queue: perl5 status: new Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About