Shawn H Corey <shawnhco...@gmail.com> writes:

> File::Find changes the working directory to each subdirectory as it
> processes it.  To prevent this, set the no_chdir flag.  See `perldoc
> File::Find` for details.  http://perldoc.perl.org/File/Find.html

I'm not finding a reference in perldoc File::Find showing how to set
that flag when using the popular notation like the script involved
here.

use File::Find;

find(
   sub {
     if(bla){
       blabla
     }
   },
    @dir
);

There are actually no examples in perldoc File::Find of set no_chdir
spercifically, but the ones I found googling are not being set in a
way I can infer how to do it in the setup below:

   find({wanted => sub {print $File::Find::name if -d}
      no_chdir => 1}, ".");

That looks like it is similar to what I tried below.

Trying to use the flag like below doesn't seem to work... or at least
the relative dirs coming in are still causing `uninitialized value'
warnings.  But if this looks like it out to set no_chdir, then its
probably some other problem... I haven't seen the root of yet.

find(
   sub {
     if(bla){
       blabla
     }
     no_chdir => 1;
   },
    @dir
);


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to