our @EXPORT = qw(cwd getcwd fastcwd fastgetcwd);
our @EXPORT_OK = qw(chdir abs_path fast_abs_path realpath fast_realpath);
-# Indicates if the XS portion has been loaded or not
-my $Booted = 0;
+eval {
+ require XSLoader;
+ XSLoader::load('Cwd');
+};
# The 'natural and safe form' for UNIX (pwd may be setuid root)
abs_path('.');
}
-# Now a callout to an XSUB. We have to delay booting of the XSUB
-# until the first time fastcwd is called since Cwd::cwd is needed in the
-# building of perl when dynamic loading may be unavailable
-sub fastcwd {
- unless ($Booted) {
- require XSLoader;
- XSLoader::load("Cwd");
- ++$Booted;
- }
- return &Cwd::_fastcwd;
-}
-
-
# Keeps track of current working directory in PWD environment var
# Usage:
# use Cwd 'chdir';
1;
}
-# Now a callout to an XSUB
-sub abs_path
-{
- unless ($Booted) {
- require XSLoader;
- XSLoader::load("Cwd");
- ++$Booted;
- }
- return &Cwd::_abs_path(@_);
-}
-
# added function alias for those of us more
# used to the libc function. --tchrist 27-Jan-00
*realpath = \&abs_path;