If you want to save the current directory so that you may return to it later, the best way to do it is to open "." (current directory) and save the handle. Then you fchdir() to this handle in order to restore it.
There are several problems with obtaining a text representation of the current directory instead. It may be longer than the system's maximum pathname length, it may change without you noticing (someone else renames a directory that is one of the parents of the current one), and it may even in some cases not be possible to determine what it is (missing permissions?). It is also expensive because you have to walk the chain of parent directories back to the root.
But: How do you fchdir() in Perl?
-Celada
In reply to Re: Testing the current directory with Cwd and File::Spec
by Anonymous Monk
in thread Testing the current directory with Cwd and File::Spec
by xdg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |