[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

re: [MacPerl] File::Find not working on Mac ?



"Georges Martin" <georges.martin@deboeck.be> writes:
} I'm trying this (very simple) code :
} 
}       use File::Find;
} 
}       find (\&process, 'MyDisk:aFolder:');
} 
}       sub process {
}               print "$dir\t$_\t$name\n";
}       }
} 
} it returns $_ but nothing in $dir nor $name.

It's easy to get it to work:

        sub process {
                print "$File::Find::dir\t$_\t$File::Find::name\n";
        }

and this is also portable.  Your original script doesn't work the way
you expect under Unix Perl 5.003, either, but does the same thing it
does under MacPerl.  I presume the answer to the question "why not?"
will turn up after a careful reading of perlfunc.html and perlmod.html
(something I don't have time for at the moment), but it looks to me
that the quick answer seems to be that File::Find requires Exporter but
doesn't export $dir or $name.

} 
} I'm using MacPerl 5.0.7r1m. Does anybody has a clue or a better suggestion for
} a +portable+ directory recursion solution ?
} 
} =8-) Georges Martin
} 
} -- 
} +-----------------------------------------------------------------------+
}  Georges Martin                       <mailto:georges.martin@deboeck.be>
} +-----------------------------------------------------------------------+
}  Groupe De Boeck s.a.                              phone +32 10 48.25.72
}  Fond Jean Paques 4                                  fax +32 10 48.25.19
}  B-1348 Louvain-la-Neuve (Belgium)                   
} +-----------------------------------------------------------------------+
} 
} 
---
--------
Paul J. Schinder
NASA Goddard Space Flight Center,
Code 693, Greenbelt, MD 20771 USA
schinder@pjstoaster.pg.md.us