Greetings All -
I am having some difficulty with a module that is using File::Find. The
method is below.
The idea is to enter this method feeding it a file name and beginning
directory and then looking for all occasions of $file_name and push those
addresses into @a_files. This works fine until I need to use FindPath again
during the same session. What I'm finding is that while @a_files looses
scope within FindPath itself, it does not in ProcessFile. In other words,
when I exit FindPath and come back into it later, @a_files is an uninitiated
array. However when ProcessFile is called, @a_files has retained the values
it had from the last call to FindPath.
Am I making sense?
sub FindPath
{
#- Var Declaration And Initialization
my ($hr_self, $file_name, $file_path) = @_;
# Array to fill with file paths
my @a_files = ();
# Search file_path for the file
find(\&ProcessFile, $file_path);
#- The Subroutine To Process Files And Directories
sub ProcessFile
{if ($_ eq $file_name){push (@a_files, $File::Find::name);}}
# Return the paths found
return @a_files;
} # end FindPath
Peace -
Ron Goral
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>