From: Tels Date: Mon, 7 Jul 2003 22:41:42 +0000 (+0200) Subject: The "reduce memory footprint and increase speed by not X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=72f15715c6c3759affc3e9b41e7833c9c3ccb901;p=p5sagit%2Fp5-mst-13.2.git The "reduce memory footprint and increase speed by not unconditionally pulling in Cwd" part of Subject: [PATCH] File::Spec on diet Message-Id: <200307072235.03364@bloodgate.com> was still valid. p4raw-id: //depot/perl@20744 --- diff --git a/lib/File/Spec/Cygwin.pm b/lib/File/Spec/Cygwin.pm index 6f3577f..541bad0 100644 --- a/lib/File/Spec/Cygwin.pm +++ b/lib/File/Spec/Cygwin.pm @@ -18,9 +18,8 @@ File::Spec::Cygwin - methods for Cygwin file specs =head1 DESCRIPTION -See File::Spec::Unix for a documentation of the methods provided -there. This package overrides the implementation of these methods, not -the semantics. +See L and L. This package overrides the +implementation of these methods, not the semantics. This module is still in beta. Cygwin-knowledgeable folks are invited to offer patches and suggestions. diff --git a/lib/File/Spec/Epoc.pm b/lib/File/Spec/Epoc.pm index 91c3a1d..89ca0b9 100644 --- a/lib/File/Spec/Epoc.pm +++ b/lib/File/Spec/Epoc.pm @@ -1,7 +1,6 @@ package File::Spec::Epoc; use strict; -use Cwd; use vars qw($VERSION @ISA); $VERSION = '1.1'; @@ -59,9 +58,12 @@ sub canonpath { return $path; } +=pod + =head1 SEE ALSO -L +See L and L. This package overrides the +implementation of these methods, not the semantics. =cut diff --git a/lib/File/Spec/Mac.pm b/lib/File/Spec/Mac.pm index 513e837..83bd709 100644 --- a/lib/File/Spec/Mac.pm +++ b/lib/File/Spec/Mac.pm @@ -8,7 +8,6 @@ $VERSION = '1.4'; @ISA = qw(File::Spec::Unix); -use Cwd; my $macfiles; if ($^O eq 'MacOS') { $macfiles = eval { require Mac::Files }; @@ -657,7 +656,7 @@ sub abs2rel { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = cwd(); + $base = $self->cwd(); } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; @@ -725,7 +724,7 @@ sub rel2abs { if ( ! $self->file_name_is_absolute($path) ) { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = cwd(); + $base = $self->cwd(); } elsif ( ! $self->file_name_is_absolute($base) ) { $base = $self->rel2abs($base) ; @@ -757,10 +756,10 @@ sub rel2abs { See the authors list in I. Mac OS support by Paul Schinder and Thomas Wegner . - =head1 SEE ALSO -L +See L and L. This package overrides the +implementation of these methods, not the semantics. =cut diff --git a/lib/File/Spec/OS2.pm b/lib/File/Spec/OS2.pm index 9bd9381..f323358 100644 --- a/lib/File/Spec/OS2.pm +++ b/lib/File/Spec/OS2.pm @@ -200,6 +200,7 @@ sub abs2rel { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { + require Cwd; $base = Cwd::sys_cwd() ; } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; @@ -258,6 +259,7 @@ sub rel2abs { if ( ! $self->file_name_is_absolute( $path ) ) { if ( !defined( $base ) || $base eq '' ) { + require Cwd; $base = Cwd::sys_cwd() ; } elsif ( ! $self->file_name_is_absolute( $base ) ) { @@ -296,6 +298,5 @@ File::Spec::OS2 - methods for OS/2 file specs =head1 DESCRIPTION -See File::Spec::Unix for a documentation of the methods provided -there. This package overrides the implementation of these methods, not -the semantics. +See L and L. This package overrides the +implementation of these methods, not the semantics. diff --git a/lib/File/Spec/Unix.pm b/lib/File/Spec/Unix.pm index 9de1cf7..e276729 100644 --- a/lib/File/Spec/Unix.pm +++ b/lib/File/Spec/Unix.pm @@ -5,8 +5,6 @@ use vars qw($VERSION); $VERSION = '1.5'; -use Cwd; - =head1 NAME File::Spec::Unix - File::Spec for Unix, base for other File::Spec modules @@ -375,7 +373,8 @@ sub abs2rel { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = cwd() ; + require Cwd; + $base = Cwd::cwd() ; } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; @@ -447,7 +446,8 @@ sub rel2abs { if ( ! $self->file_name_is_absolute( $path ) ) { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = cwd() ; + require Cwd; + $base = Cwd::cwd() ; } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; diff --git a/lib/File/Spec/VMS.pm b/lib/File/Spec/VMS.pm index 70eb39b..9d909b1 100644 --- a/lib/File/Spec/VMS.pm +++ b/lib/File/Spec/VMS.pm @@ -8,7 +8,6 @@ $VERSION = '1.4'; @ISA = qw(File::Spec::Unix); -use Cwd; use File::Basename; use VMS::Filespec; @@ -404,7 +403,8 @@ sub abs2rel { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = cwd() ; + require Cwd; + $base = Cwd::cwd() ; $base = $self->canonpath( $base ) ; } elsif ( ! $self->file_name_is_absolute( $base ) ) { @@ -464,7 +464,8 @@ sub rel2abs { if ( ! $self->file_name_is_absolute( $path ) ) { # Figure out the effective $base and clean it up. if ( !defined( $base ) || $base eq '' ) { - $base = cwd() ; + require Cwd; + $base = Cwd::cwd() ; } elsif ( ! $self->file_name_is_absolute( $base ) ) { $base = $self->rel2abs( $base ) ; @@ -501,7 +502,8 @@ sub rel2abs { =head1 SEE ALSO -L +See L and L. This package overrides the +implementation of these methods, not the semantics. =cut diff --git a/lib/File/Spec/Win32.pm b/lib/File/Spec/Win32.pm index 26d92ba..d97708a 100644 --- a/lib/File/Spec/Win32.pm +++ b/lib/File/Spec/Win32.pm @@ -1,7 +1,6 @@ package File::Spec::Win32; use strict; -use Cwd; use vars qw(@ISA $VERSION); require File::Spec::Unix; @@ -360,7 +359,8 @@ Novell NetWare inherits its File::Spec behaviour from File::Spec::Win32. =head1 SEE ALSO -L +See L and L. This package overrides the +implementation of these methods, not the semantics. =cut