in reply to File::Find in a thread safe fashion

I think that thread variables are unshared by default and thus your use of File::Find and $File::Find::name should still work. But I haven't used threads, so I can't really tell you.

While searching for something else, I came across acme's journal entry where he mentions Proc::ParallelLoop, which does fork subprocesses to work on loops in parallel. As you do the output directly from your threads and Proc::ParallelLoop seems even to buffer the output from the threads, you could be able to directly use that module. I haven't used it though.

Replies are listed 'Best First'.
Re^2: File::Find in a thread safe fashion
by Preceptor (Deacon) on Jul 28, 2006 at 11:08 UTC
    If I do run more than one thread, I get a whole lot of errors like:

    Can't cd to (/nas/fs001/export/home/) .GROUP_CONFIG: No such file or directory at ./disk_report.pl line 56

    I am assuming that this is because File::Find is using shared vars for at least something that it does.