Hi
Well when I first ran into this problem I thought that it would be a simple problem to solve. but I can't seem to figure it out. The problem occurs when I am using File::Find to recusivly search a direcotry for files. The problem is that when i get to a directory that doesn't exist it prints out.
Can't stat e:\logs: No such file or directoryI have to search many directories and if the program doesn't find one it just spits out this message and goes on to the next one. Well I want to be able to know if it couldn't not find that direcotry.
Well at first i tried setting a variable equal to tbe return value.
my $temp = find ({wanted => \&wanted,bydepth =>0},"e:\\logs",);But the problem was that even if it worked or if it didn't find the directory it would return zero. So next I tried to eval the statement and to catch the error that way.
But it didn't catch the errorI know that there is a module out there called "exceptions" to use try and catch but I installed it and it tells me i need to install "methodmaker". And I don't even know if exceptions will work. I know that there is also something that is called "backticks" that is used to get what is outputed to the screen (i think). Is there a simple way to figure out if it returned an error or not??any help would be great thanks,Victoreval{ find ({wanted => \&wanted,bydepth =>0},"e:\\logs",) }; warn $@ if $@;
In reply to catching errors from file::find by VicBalta
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |