Subject: | Should canonpath() return? empty string or undef? (On VMS) |
Hello and thanks for maintaining PathTools.
The question/bug I have is:
"What should File::Spec->canonpath() return?"
On VMS (PathTools 3.17 and 3.25) I get undef:
perl -e "use strict;use warnings;use File::Spec;print defined
File::Spec->canonpath() ? 'def' : 'undef';"
undef
On UNIX (PathTools 3.23) I get empty string:
perl -e "use strict;use warnings;use File::Spec;print defined
File::Spec->canonpath() ? 'def' : 'undef';"
def
I think this is because of the return from canonpath,
UNIX:
return "$node$path";
VMS:
return $path;
I patched version 3.25 on VMS to return "$path" and it passes all it's
tests*.
Thanks for your thoughts on this. I got to this point from installing
DBI 1.59 on VMS, and it calling catdir() with files as arguments and
this causing warnings from the undefined value being returned from
canonpath, example:
perl -we "use strict;use File::Spec;print
File::Spec->catdir('a','valid_dir_name');"
[.a.valid_dir_name]
perl -we "use strict;use File::Spec;print
File::Spec->catdir('a','file_not_a_dir.txt');"
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 508.
Use of uninitialized value in pattern match (m//) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 39.
Use of uninitialized value in transliteration (tr///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 46.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 47.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 48.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 49.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 50.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 51.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 52.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 59.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 69.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 70.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 71.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 72.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 73.
Use of uninitialized value in string eq at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 74.
Use of uninitialized value in substitution (s///) at
/perl_root/lib/VMS_AXP/5_8_7/File/Spec/VMS.pm line 74.
Use of uninitialized value in print at -e line 1.
I'll post this to vmsperl and see if anyone has any thoughts.
Cheers,
Peter (Stig) Edwards
*after making the following change:
PathTools-3.25/t/tmpdir.t
17 local %ENV;
18 File::Spec::Win32->tmpdir;
19 ok scalar keys %ENV, 0, "Win32->tmpdir() shouldn't change the
contents of %ENV";
20 }
******
17 if($^O eq 'VMS'){
18 ok 1,1, 'Can not make list assignment to %ENV on this system,
will exit if attempt to';
19 } else {
20 local %ENV;
21 File::Spec::Win32->tmpdir;
22 ok scalar keys %ENV, 0, "Win32->tmpdir() shouldn't change the
contents of %ENV";
23 }
24 }
END