Subject: | Cwd is very slow on MSWin32 |
I found out that the Cwd.pm takes very long to load on my Windows XP machine. I've tried ActivePerl 5.8.0, but also updated to Cwd 2.17.
The reason is that the Cwd.pm searches for the pwd command in the whole PATH, which shouldn't be done for windows.
My path contains also network drives which take long to look at.
The following code snipped is my workaround in Cwd.pm, perhaps you find a much better solution to avoid the PATH lookup for windows.
===line 218============================================
# Since some ports may predefine cwd internally (e.g., NT)
# we take care not to override an existing definition for cwd().
unless(defined &cwd) {
# The pwd command is not available in some chroot(2)'ed environments
## SS don't look into path on windows
## if( $^O eq 'MacOS' || (defined $ENV{PATH} &&
## grep { -x "$_/pwd" } split(':', $ENV{PATH})) )
## {
## *cwd = \&_backtick_pwd;
## }
## else {
*cwd = \&getcwd;
## }
}
======================================================