Subject: | Test::Pod 1.22 PATCH for VMS |
VMS directory structure is very different to anything else.
(See: http://perldoc.perl.org/perlport.html#VMS)
Test::Post 1.22 under 5.8.7 built for VMS_AXP breaks on the test case:
all_pod_files.t
The root cause is the line:
push @queue, map "$file/$_", @newfiles;
in the sub all_pod_files in Pod.pm, if $file is a directory, (and it is
in the test case mentioned) then building up the queue results in an
entry:
blib/lib.dir/test.dir
(Under VMS directories have the extension .dir)
Unfortuently on a later iteration of this loop this entry is then
queried to see if it is a directory (-d), it's now a mix of VMS syntax
and *nix syntax, -d does not evaluate to true for this entry.
The fix I used was to replace the line above with:
foreach my $newfile (@newfiles) {
if(-f File::Spec->catfile($file,$newfile)){
push @queue, File::Spec->catfile($file,$newfile);
}else{
push @queue, File::Spec->catdir($file,$newfile);
}
}
This treats the entry in @newfiles differently if it is a directory or a
file, this probably makes no difference on most OS's, but on VMS it
results in the entry becoming:
[.blib.lib.test]
Believe it or not this is the correct syntax as understood by Perl VMS.
This results in -d being true and the sub all_pod_files behaving as
expected on VMS.
As for the test case: all_pod_files.t, this is what I did to get it to
pass:
# the expected array is now built up using File::Spec->catfile
my @expected;
$expected[0] = File::Spec->catfile('blib','lib','Test','Pod.pm');
$expected[1] = File::Spec->catfile('t','pod','good-pod-script');
$expected[2] = File::Spec->catfile('t','pod','good.pod');
$expected[3] = File::Spec->catfile('t','pod','no_pod.pod');
# these next two lines unchanged
@files = sort @files;
@expected = sort @expected;
# There are 2 other little things that are required for VMS
# (1.) case in-sensitivity
# (2.) files without extensions still have a period/dot (.)
if ($^O eq 'VMS') {
$expected[1] = File::Spec->catfile('t','pod','good-pod-script.');
@files = map {lc($_)} @files;
@expected = map {lc($_)} @expected;
}
Cheers,
Peter (Stig) Edwards