Subject: | Module::Build::Base::cwd breaks symlinks |
When Module::Build gets the current working directory, it uses Cwd::cwd.
Cwd::cwd removes symlinks.
This unlinked path is both used for Module::Build itself, and is also
the context that the tests will be run in.
If the code in the module has any functionality that relies on the path
that it is running in, this results in a change of behaviour that can
break the code/tests.
Module::Build::Base::cwd needs to be changed to a version that doesn't
break symlinks, using $ENV{PWD} (if it is set).
sub cwd {
require Cwd;
if ( defined $ENV{PWD} ) {
return $ENV{PWD};
} else {
return Cwd::cwd();
}
}
or alternatively... (but a bit more evil)
sub cwd {
require Cwd;
require File::Spec;
Cwd::chdir(File::Spec->curdir);
return $ENV{PWD};
}