in reply to Best way to change directories for a script?
With the caveat that I haven't used it, I did stumble across File::chdir recently, which supposedly lets you localize $CWD to change directories and the change is reverted as soon as the localization goes out of scope. Seemed handy as a way of letting something else keep track of the old directory instead of doing it yourself.
Again, unlikely it's thread safe -- almost no directory change is, I believe -- you just have to use absolute paths for everything if you're using threads (or fork on Windows).
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|