Show quoted text
How many successes a test has does not negate any failures.
The original ticketer of two years ago is correct. The fact is, on
Windows XP Home edition at least, chdir() does not change the directory
unless $ENV{HOME} is set, which it is not by default. Your test script
therefore will fail by default on Windows XP Home edition machines.
For Windows 2K and above, $ENV{USERPROFILE} is defined by default, so on
Windows 2K and above, chdir($ENV{USERPROFILE}) will work, as will
setting $ENV{HOME} prior to the test.
Show quoted text> did the test fail?
Yes. However, User.pm clearly works, so I installed it anyway. It is
only the test that is faulty.
In case there are doubts about this, I will now paste a short test
script, and then paste the results. Notice the "uninitialized value" in
the results, which of course refer to the first attempt at printing
$ENV{HOME}.
--------------paste script
#!/usr/bin/perl -w
use Cwd qw( getcwd abs_path);
use strict;
chdir("C:\\temp\\");
my $oldpwd = getcwd;
chdir();
my $newpwd = getcwd;
print ("oldpwd is $oldpwd\n");
print ("newpwd is $newpwd\n");
print ("ENV HOME is ", $ENV{HOME}, "\n");
print ("ENV USERPROFILE is ", $ENV{USERPROFILE}, "\n");
$ENV{HOME} = $ENV{USERPROFILE} if ($^O eq 'MSWin32');
chdir();
my $lastpwd = getcwd;
print ("lastpwd is $lastpwd\n");
--------------end paste script
----------paste results
C:\temp>perl test.pl
oldpwd is C:/temp
newpwd is C:/temp
Use of uninitialized value in print at test.pl line 14.
ENV HOME is
ENV USERPROFILE is C:\Documents and Settings\malcolm
lastpwd is C:/Documents and Settings/malcolm
----------end paste results
Thanks