No such thing as a small change | |
PerlMonks |
Re: Perl under windows: mysteriously skipping over subroutineby UnstoppableDrew (Sexton) |
on Apr 23, 2008 at 21:42 UTC ( [id://682504]=note: print w/replies, xml ) | Need Help?? |
Ok, this is what I get for assuming other people can write code. mr_mischief was correct, the calls to pathrm were not using the second argument to force the call to pathempty. My bad for not re-reading the docs. Makes me wonder how this ever worked, as the return value of pathrm was not being checked so every call to delete a directory was silently failing and being ignored. Now that I'm done chasing that red herring, perhaps I can solve the original problem.
This one server has been throwing the error: After some extensive time in the debugger, here's what seems to be happening: pathrmdir calls pathempty, which opens the directory and iterates over the items, calling unlink for files and pathrmdir for directories. At some point it hits a directory, the sole content of which is an empty directory . pathrmdir calls pathempty which calls pathrmdir which calls pathempty, which does nothing and returns. pathrmdir calls rmdir on the empty directory and returns. Back in pathempty it tries to close the dir handle and exits with code 9. I think these functions need to localize the dir handle it's using, I'm surprised this doesn't come up more often. I have just reproduced it using the following: For a directory that looks like this: where baz is the only thing in bar, and baz is empty, using this code: the output is:
And that's on a different pc than the one originally showing the problem. I will try localizing the dir handle and see what happens.
In Section
Seekers of Perl Wisdom
|
|