3 # This library is no longer being maintained, and is included for backward
4 # compatibility with Perl 4 programs which may require it.
5 # This legacy library is deprecated and will be removed in a future
8 # In particular, this should not be used as an example of modern Perl
9 # programming techniques.
11 # Suggested alternative: Cwd
13 warn( "The 'fastcwd.pl' legacy library is deprecated and will be"
14 . " removed in the next major release of perl. Please use the"
15 . " Cwd module instead." );
17 # Usage: $cwd = &fastcwd;
19 # This is a faster version of getcwd. It's also more dangerous because
20 # you might chdir out of a directory that you can't chdir back into.
23 local($odev, $oino, $cdev, $cino, $tdev, $tino);
27 ($cdev, $cino) = stat('.');
29 ($odev, $oino) = ($cdev, $cino);
31 ($cdev, $cino) = stat('.');
32 last if $odev == $cdev && $oino == $cino;
40 ($tdev, $tino) = lstat($_);
41 last unless $tdev != $odev || $tino != $oino;
46 chdir($path = '/' . join('/', @path));