in reply to Perl under windows: mysteriously skipping over subroutine
This one server has been throwing the error:
closedir() attempted on invalid dirhandle PTH_DH at C:\Work\trunk\3pty\perl\lib/File/Copy/Recursive.pm line 318.
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:C:\TMP\PATHTEST |--bar |--baz
the output is:perl -e "use File::Copy::Recursive qw(pathrmdir); pathrmdir('pathtest' +,1); print qq(done\n);"
closedir() attempted on invalid dirhandle PTH_DH at c:\trunk\3pty\perl +\lib/File/Copy/Recursive.pm line 318. closedir() attempted on invalid dirhandle PTH_DH at c:\trunk\3pty\perl +\lib/File/Copy/Recursive.pm line 318. done
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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl under windows: mysteriously skipping over subroutine
by UnstoppableDrew (Sexton) on Apr 23, 2008 at 21:46 UTC | |
Re^2: Perl under windows: mysteriously skipping over subroutine
by mr_mischief (Monsignor) on Apr 24, 2008 at 16:04 UTC |