Hi Bill,

Thank you very much for the verbose program. I was able to figure out what
was wrong. It is a bug in File::Spec->rel2abs which fails to check the
current working directory within a forked Win32 program.

Here is a buggy program:

#!perl -wl

use strict;
use File::Spec;
use Cwd;

my $localName = 'test_dir\test_file';
my $pid = fork;

# Buggy when $pid == 0 and works as expected when $pid != 0
if ($pid == 0) {
    print getcwd;  # Output: C:/dev
    chdir 'C:/temp';
    print getcwd;  # Output: C:/temp
    print File::Spec->rel2abs($localName);
    # Output: C:\dev\test_dir\test_file
    
    # The output of rel2abs should have been: C:\temp\test_dir\test_file
}

__END__

It works correctly under Linux. Thank you for the reply which made me think
further. :-)

Regards,
Alan Haggai Alavi.
-- 
The difference makes the difference

Reply via email to