The documentation for the Cwd module states that fast_abs_path is a “more dangerous, but potentially faster version of abs_path“. In what way is it dangerous? Under what circumstances is it faster? Does the behavior vary by platform?
The documentation for the Cwd module states that fast_abs_path is a more dangerous, but
Share
fast_abs_pathinvokeschdirto have the kernel resolve the path leading up to what you passed it all at once, instead of carefully checking each component and building a new path piece by piece; the problem is that it is possible that permissions would prevent it fromchdiring back to the original directory afterward. (Some systems can useopenandfchdirto get around this, but it’s not reliably available on all platforms where Perl runs.)Whether this can even occur depends on whether it is possible for your script to execute in a directory which it would not be able to access directly. On Unix-like systems this can happen when a setuid wrapper
chdirs to a restricted permissions area and then drops the setuid. (Historically the restricted permissions are on a path component namedlock; various mail and Usenet news subsystems have used this to protect their queue directories.)