summaryrefslogtreecommitdiff
path: root/dist
diff options
context:
space:
mode:
authorDaniel Dragan <bulk88@hotmail.com>2015-07-29 09:54:51 -0400
committerTony Cook <tony@develop-help.com>2015-07-30 11:38:30 +1000
commit3480fbaaaea849eca1f4747c4f85938960b20956 (patch)
tree0b66eaf9a85af2467b8f6a45521f55f59702652f /dist
parent5eeb15d3044f948299223cffaa126f04a8bb45ec (diff)
downloadperl-3480fbaaaea849eca1f4747c4f85938960b20956.tar.gz
Cwd.pm, dont repeatedly access magic %ENV vars
%ENV is magic/tied, a lexical is faster than calling out to magic APIs with gets and sets (or checks for them). Less glob and hash lookups too. Return the lexical instead of the magic var so there isn't a search for magic from pp_leavesub's sv_mortalcopy. Even though env mg vtable doesn't have a getter or GMAGIC, SvVSTRING_mg executes mg_find for random, get and set magic inside Perl_sv_setsv_flags.
Diffstat (limited to 'dist')
-rw-r--r--dist/PathTools/Cwd.pm51
-rw-r--r--dist/PathTools/lib/File/Spec.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Cygwin.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Epoc.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Functions.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Mac.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/OS2.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Unix.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/VMS.pm2
-rw-r--r--dist/PathTools/lib/File/Spec/Win32.pm2
10 files changed, 37 insertions, 32 deletions
diff --git a/dist/PathTools/Cwd.pm b/dist/PathTools/Cwd.pm
index 49cc4c1b39..0765de43df 100644
--- a/dist/PathTools/Cwd.pm
+++ b/dist/PathTools/Cwd.pm
@@ -3,7 +3,7 @@ use strict;
use Exporter;
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
-$VERSION = '3.56';
+$VERSION = '3.57';
my $xs_version = $VERSION;
$VERSION =~ tr/_//;
@@ -600,20 +600,23 @@ sub _vms_abs_path {
}
sub _os2_cwd {
- $ENV{'PWD'} = `cmd /c cd`;
- chomp $ENV{'PWD'};
- $ENV{'PWD'} =~ s:\\:/:g ;
- return $ENV{'PWD'};
+ my $pwd = `cmd /c cd`;
+ chomp $pwd;
+ $pwd =~ s:\\:/:g ;
+ $ENV{'PWD'} = $pwd;
+ return $pwd;
}
sub _win32_cwd_simple {
- $ENV{'PWD'} = `cd`;
- chomp $ENV{'PWD'};
- $ENV{'PWD'} =~ s:\\:/:g ;
- return $ENV{'PWD'};
+ my $pwd = `cd`;
+ chomp $pwd;
+ $pwd =~ s:\\:/:g ;
+ $ENV{'PWD'} = $pwd;
+ return $pwd;
}
sub _win32_cwd {
+ my $pwd;
# Need to avoid taking any sort of reference to the typeglob or the code in
# the optree, so that this tests the runtime state of things, as the
# ExtUtils::MakeMaker tests for "miniperl" need to be able to fake things at
@@ -622,35 +625,38 @@ sub _win32_cwd {
# problems (for reasons that we haven't been able to get to the bottom of -
# rt.cpan.org #56225)
if (*{$DynaLoader::{boot_DynaLoader}}{CODE}) {
- $ENV{'PWD'} = Win32::GetCwd();
+ $pwd = Win32::GetCwd();
}
else { # miniperl
- chomp($ENV{'PWD'} = `cd`);
+ chomp($pwd = `cd`);
}
- $ENV{'PWD'} =~ s:\\:/:g ;
- return $ENV{'PWD'};
+ $pwd =~ s:\\:/:g ;
+ $ENV{'PWD'} = $pwd;
+ return $pwd;
}
*_NT_cwd = defined &Win32::GetCwd ? \&_win32_cwd : \&_win32_cwd_simple;
sub _dos_cwd {
+ my $pwd;
if (!defined &Dos::GetCwd) {
- $ENV{'PWD'} = `command /c cd`;
- chomp $ENV{'PWD'};
- $ENV{'PWD'} =~ s:\\:/:g ;
+ chomp($pwd = `command /c cd`);
+ $pwd =~ s:\\:/:g ;
} else {
- $ENV{'PWD'} = Dos::GetCwd();
+ $pwd = Dos::GetCwd();
}
- return $ENV{'PWD'};
+ $ENV{'PWD'} = $pwd;
+ return $pwd;
}
sub _qnx_cwd {
local $ENV{PATH} = '';
local $ENV{CDPATH} = '';
local $ENV{ENV} = '';
- $ENV{'PWD'} = `/usr/bin/fullpath -t`;
- chomp $ENV{'PWD'};
- return $ENV{'PWD'};
+ my $pwd = `/usr/bin/fullpath -t`;
+ chomp $pwd;
+ $ENV{'PWD'} = $pwd;
+ return $pwd;
}
sub _qnx_abs_path {
@@ -669,8 +675,7 @@ sub _qnx_abs_path {
}
sub _epoc_cwd {
- $ENV{'PWD'} = EPOC::getcwd();
- return $ENV{'PWD'};
+ return $ENV{'PWD'} = EPOC::getcwd();
}
diff --git a/dist/PathTools/lib/File/Spec.pm b/dist/PathTools/lib/File/Spec.pm
index 8c77c986e3..2f35526555 100644
--- a/dist/PathTools/lib/File/Spec.pm
+++ b/dist/PathTools/lib/File/Spec.pm
@@ -3,7 +3,7 @@ package File::Spec;
use strict;
use vars qw(@ISA $VERSION);
-$VERSION = '3.56';
+$VERSION = '3.57';
$VERSION =~ tr/_//;
my %module = (MacOS => 'Mac',
diff --git a/dist/PathTools/lib/File/Spec/Cygwin.pm b/dist/PathTools/lib/File/Spec/Cygwin.pm
index 1b77e6adbd..e5839e9d58 100644
--- a/dist/PathTools/lib/File/Spec/Cygwin.pm
+++ b/dist/PathTools/lib/File/Spec/Cygwin.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.56';
+$VERSION = '3.57';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/lib/File/Spec/Epoc.pm b/dist/PathTools/lib/File/Spec/Epoc.pm
index 7bc386768e..390a64118f 100644
--- a/dist/PathTools/lib/File/Spec/Epoc.pm
+++ b/dist/PathTools/lib/File/Spec/Epoc.pm
@@ -3,7 +3,7 @@ package File::Spec::Epoc;
use strict;
use vars qw($VERSION @ISA);
-$VERSION = '3.56';
+$VERSION = '3.57';
$VERSION =~ tr/_//;
require File::Spec::Unix;
diff --git a/dist/PathTools/lib/File/Spec/Functions.pm b/dist/PathTools/lib/File/Spec/Functions.pm
index 8eafe2483b..5c2cec0580 100644
--- a/dist/PathTools/lib/File/Spec/Functions.pm
+++ b/dist/PathTools/lib/File/Spec/Functions.pm
@@ -5,7 +5,7 @@ use strict;
use vars qw(@ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $VERSION);
-$VERSION = '3.56';
+$VERSION = '3.57';
$VERSION =~ tr/_//;
require Exporter;
diff --git a/dist/PathTools/lib/File/Spec/Mac.pm b/dist/PathTools/lib/File/Spec/Mac.pm
index 02cae14b74..7cc816f3e7 100644
--- a/dist/PathTools/lib/File/Spec/Mac.pm
+++ b/dist/PathTools/lib/File/Spec/Mac.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.56';
+$VERSION = '3.57';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/lib/File/Spec/OS2.pm b/dist/PathTools/lib/File/Spec/OS2.pm
index fb8f101692..8d3951fe44 100644
--- a/dist/PathTools/lib/File/Spec/OS2.pm
+++ b/dist/PathTools/lib/File/Spec/OS2.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.56';
+$VERSION = '3.57';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/lib/File/Spec/Unix.pm b/dist/PathTools/lib/File/Spec/Unix.pm
index f76b29e356..48e2b60799 100644
--- a/dist/PathTools/lib/File/Spec/Unix.pm
+++ b/dist/PathTools/lib/File/Spec/Unix.pm
@@ -3,7 +3,7 @@ package File::Spec::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '3.56';
+$VERSION = '3.57';
my $xs_version = $VERSION;
$VERSION =~ tr/_//;
diff --git a/dist/PathTools/lib/File/Spec/VMS.pm b/dist/PathTools/lib/File/Spec/VMS.pm
index 254f5248cd..5e4a3b3a68 100644
--- a/dist/PathTools/lib/File/Spec/VMS.pm
+++ b/dist/PathTools/lib/File/Spec/VMS.pm
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.56';
+$VERSION = '3.57';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);
diff --git a/dist/PathTools/lib/File/Spec/Win32.pm b/dist/PathTools/lib/File/Spec/Win32.pm
index 53f3854cd7..77e0fed024 100644
--- a/dist/PathTools/lib/File/Spec/Win32.pm
+++ b/dist/PathTools/lib/File/Spec/Win32.pm
@@ -5,7 +5,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '3.56';
+$VERSION = '3.57';
$VERSION =~ tr/_//;
@ISA = qw(File::Spec::Unix);