diff options
author | Doug MacEachern <dougm@covalent.net> | 2001-05-31 10:37:37 -0700 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-06-01 12:47:21 +0000 |
commit | f22d8e4b6ac8b32788591ab647fd40e18ea984f2 (patch) | |
tree | 3fedd9924b8c26080afc094eb7088cc855b0ed71 /lib/Cwd.pm | |
parent | 835f860c4f5e105fc77374cb91abb368b434a8b8 (diff) | |
download | perl-f22d8e4b6ac8b32788591ab647fd40e18ea984f2.tar.gz |
[patch] Cwd.xs optimizations/abstraction
Message-ID: <Pine.LNX.4.21.0105311733270.732-100000@mako.covalent.net>
p4raw-id: //depot/perl@10369
Diffstat (limited to 'lib/Cwd.pm')
-rw-r--r-- | lib/Cwd.pm | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/lib/Cwd.pm b/lib/Cwd.pm index 4e4d39c8f7..27a3105f3b 100644 --- a/lib/Cwd.pm +++ b/lib/Cwd.pm @@ -85,8 +85,10 @@ use base qw/ Exporter /; 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) @@ -123,19 +125,6 @@ sub getcwd 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'; @@ -206,17 +195,6 @@ sub 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; |