loveperl0721 has asked for the wisdom of the Perl Monks concerning the following question:

Folks: I found an issue with using File::Find. Here is my code
use strict; use warnings; use File::Find; my $in_dir = "C:\\temp"; my $rc = q{}; sub select_files { print ("function was entered\n"); } $File::Find::prune = 0; $rc=find(\&select_files, $in_dir); print ("find returned with $rc\n"); exit(0);
The code compiles clean under ActivePerl 5.8.9 on WinXP. The version of File::Find is 1.13. The issue is that neither of the print statements generate any output. Gotta believe I am doing something wrong, but exactly what, has not hit me yet. Any ideas on what I am doing wrong? Thanks.

Replies are listed 'Best First'.
Re: File::Find stalls
by Anonymous Monk on Nov 10, 2010 at 03:40 UTC
    It works here (Strawberry Perl v5.12.0, MSWin32-x86-multi-thread; File::Find version 1.15).

    See if you can upgrade to, or at least try the code from, File::Find 1.15.

      I upgraded to File::Find 1.15 and the results are the same. I am going to try using the built-in perl debugger to track this issue down. Thanks.
        I used the built in perl debugger. Here is the result of that exercise.
        M:\My Documents\Code\perl>perl -d test6.pl Loading DB routines from perl5db.pl version 1.31 Editor support available. Enter h or `h h' for help, or `perldoc perldebug' for more help. main::(test6.pl:5): my $in_dir = "C:\\tmp"; DB<1> l 5==> my $in_dir = + "C:\\tmp "; 6 7 sub select_files { 8: print ("function was entered\n"); 9 } 10 11: $File::Find::prune = 0; 12: unless (find(\&select_files, $in_dir)) { 13: print ("Find failed with $!\n"); 14 } DB<1> n main::(test6.pl:11): $File::Find::prune + = 0; DB<1> n main::(test6.pl:12): unless (find(\&select_files, $in_dir)) { DB<1> n main::CODE(0x1e57a58)(C:/Perl/site/lib/Cwd.pm:752): 752: $ENV{'PWD'} = Win32::GetCwd(); 99 levels deep in subroutine calls! DB<1>
        You will notice that I added some debugging code in an effort to figure out what is going on, but again none of it fired. Thanks.