find docs evolving

dc2000 on 2002-09-18T21:14:25

The File::Find docs said:


use File::Find;
find(\&wanted, '/foo','/bar');
sub wanted { ... }

The number of times I have found code which is meant to search one directory but
includes a bogus second dir argument is astonishing.

Likewise, I've encountered instances of multiple invocations of File::Find to search
more than two directories.

find(\&wanted, '/foo','/bar');
find(\&wanted, '/foo2','/bar2');

When I've been able to ask the author why they appended a second dir argument,
or limited themselves at two dir arguments, they've proudly pointed to their due diligence
of RTFMing the standard docs SYNOPSIS which show File::Find used with
two and only two directory arguments.

So I am pleased that the v5.8.0 docs for File::Find show a more generic:

use File::Find;
find(\&wanted, @directories_to_seach);
sub wanted { ... }



wanted()

petdance on 2002-09-18T22:13:10

Even more confusing is calling the callback "wanted()". My initial reaction on seeing that is thinking "wanted() needs to return a boolean", and just the other day I helped someone on IRC with that exact same conclusion.

Re:wanted()

vsergu on 2002-09-18T23:03:25

Yes, it should be called process() or something.