2 # Author: Marek Rouchal <marek@saftsack.fs.uni-bayreuth.de>
7 # The ../../../../../lib is for finding lib/utf8.pm
8 # when running under all-utf8 settings (pod/find.t)
9 # does not directly require lib/utf8.pm but regular
10 # expressions will need that.
11 @INC = qw(../lib ../../../../../lib);
24 use Pod::Find qw(pod_find pod_where);
31 my $THISDIR = Cwd::cwd();
32 my $VERBOSE = $ENV{PERL_CORE} ? 0 : ($ENV{TEST_VERBOSE} || 0);
33 my $lib_dir = $ENV{PERL_CORE} ?
34 File::Spec->catdir('pod', 'testpods', 'lib')
35 : File::Spec->catdir($THISDIR,'lib');
42 $lib_dir = $ENV{PERL_CORE} ?
43 VMS::Filespec::unixify(File::Spec->catdir('pod', 'testpods', 'lib'))
44 : VMS::Filespec::unixify(File::Spec->catdir($THISDIR,'-','lib','pod'));
46 $Qlib_dir =~ s#\/#::#g;
49 if (eval 'require VMS::Feature') {
50 $vms_unix_rpt = VMS::Feature::current("filename_unix_report");
51 $vms_efs = VMS::Feature::current("efs_charset");
53 my $unix_rpt = $ENV{'DECC$FILENAME_UNIX_REPORT'} || '';
54 my $efs_charset = $ENV{'DECC$EFS_CHARSET'} || '';
55 $vms_unix_rpt = $unix_rpt =~ /^[ET1]/i;
56 $vms_efs = $efs_charset =~ /^[ET1]/i;
59 # Traditional VMS mode only if VMS is not in UNIX compatible mode.
60 $unix_mode = ($vms_efs && $vms_unix_rpt);
63 print "### searching $lib_dir\n";
64 my %pods = pod_find($lib_dir);
65 my $result = join(',', sort values %pods);
66 print "### found $result\n";
67 my $compare = $ENV{PERL_CORE} ?
82 $compare = lc($compare);
83 my $undollared = $Qlib_dir;
84 $undollared =~ s/\$/\\\$/g;
85 $undollared =~ s/\-/\\\-/g;
86 $result =~ s/$undollared/pod::/g;
89 my @result = split(/,/,$result);
90 my @compare = split(/,/,$compare);
92 $count += grep {/$_/} @result;
94 ok($count/($#result+1)-1,$#compare);
96 elsif (File::Spec->case_tolerant || $^O eq 'dos') {
97 ok(lc $result,lc $compare);
100 ok($result,$compare);
103 print "### searching for File::Find\n";
104 $result = pod_where({ -inc => 1, -verbose => $VERBOSE }, 'File::Find')
105 || 'undef - pod not found!';
106 print "### found $result\n";
109 if ($^O eq 'VMS') { # privlib is perl_root:[lib] OK but not under mms
111 $compare = "../lib/File/Find.pm";
113 $compare = "lib.File]Find.pm";
115 $result =~ s/perl_root:\[\-?\.?//i;
116 $result =~ s/\[\-?\.?//i; # needed under `mms test`
117 ok($result,$compare);
120 $compare = $ENV{PERL_CORE} ?
121 File::Spec->catfile(File::Spec->updir, 'lib','File','Find.pm')
122 : File::Spec->catfile($Config::Config{privlibexp},"File","Find.pm");
123 ok(_canon($result),_canon($compare));
126 # Search for a documentation pod rather than a module
127 my $searchpod = 'Stuff';
128 print "### searching for $searchpod.pod\n";
130 { -dirs => [ File::Spec->catdir(
131 $ENV{PERL_CORE} ? () : qw(t), 'pod', 'testpods', 'lib', 'Pod') ],
132 -verbose => $VERBOSE }, $searchpod)
133 || "undef - $searchpod.pod not found!";
134 print "### found $result\n";
136 $compare = File::Spec->catfile(
137 $ENV{PERL_CORE} ? () : qw(t),
138 'pod', 'testpods', 'lib', 'Pod' ,'Stuff.pm');
139 ok(_canon($result),_canon($compare));
141 # make the path as generic as possible
145 $path = File::Spec->canonpath($path);
146 my @comp = File::Spec->splitpath($path);
147 my @dir = File::Spec->splitdir($comp[1]);
148 $comp[1] = File::Spec->catdir(@dir);
149 $path = File::Spec->catpath(@comp);
150 $path = uc($path) if File::Spec->case_tolerant;
151 print "### general path: $path\n" if $VERBOSE;