Krishna P Krishna P - 1 year ago 47
Perl Question

How to resolve conflict with File::Find::Rule and File::Find

To elaborate,

I am using

to get the path of a specific file which exists in multiple sub directories and sometimes in sub directories directory.


Apart from this, i am using

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

Here basically the wanted function is just to change permissions....

The problem is...when I add
, the
function mentioned above says file itself doesn't exist. If I don't add the rule module use then the find part works great

Can anyone help me sort this one. Any ideas here would be helpful. I tried all possible combinations....but nothing works...

Thank you in advance :)

Answer Source

It's hard to tell from your description of the problem, but I suspect the problem is related to the fact that both

use File::Find::Rule;


use File::Find;

export a function named find. Replace

use File::Find::Rule;


use File::Find::Rule qw( );

to avoid importing find from File::Find::Rule.