3 # Usage: $cwd = &fastcwd;
5 # This is a faster version of getcwd. It's also more dangerous because
6 # you might chdir out of a directory that you can't chdir back into.
9 local($odev, $oino, $cdev, $cino, $tdev, $tino);
13 ($cdev, $cino) = stat('.');
15 ($odev, $oino) = ($cdev, $cino);
17 ($cdev, $cino) = stat('.');
18 last if $odev == $cdev && $oino == $cino;
26 ($tdev, $tino) = lstat($_);
27 last unless $tdev != $odev || $tino != $oino;
32 chdir($path = '/' . join('/', @path));