I decided to check out the coverage of a little program and am running
into a bump. The code is part of a suite of code which uses the
environment to pass options. One of those environment variables
happens to be called PWD, and it doesn't hold the present working
directory. (It stands for "Period, Week, Day" and since this suite is
on windows, PWD had no definition in its shell beforehand.)

The problem is, when I run my script with "perl -MDevel::Cover
mycode.pl", Devel::Cover seems to overwrite $ENV{PWD} with the current
directory.

It's easy to show-

> cat > foo.pl
#!/usr/bin/perl

print "ENV{PWD}=$ENV{PWD}\n";

> set PWD='xyz'
> foo.pl
ENV{PWD}=xyz
> perl -MDevel::Cover foo.pl
(... Devel::Cover stuff...)
ENV{PWD}=D:/home/yhluc00/bin/
(... Devel::Cover stuff...)


Is there a workaround where my code can get the original $Env{PWD}? I
can change the test scripts, but I don't "own" all the code in the
suite that uses $ENV{PWD}.

Reply via email to