Subject: | fix @INC search order |
Hello,
Some perl installations have "vendor" installation tree located under
"perl" installation tree, e.g.
$ perl -V
...
@INC:
/usr/lib/perl5/i386-linux
/usr/lib/perl5
...
/usr/lib/perl5/vendor_perl/i386-linux
/usr/lib/perl5/vendor_perl
...
$
Tk::Pod then cannot gork "vendor" tree and simply produces entries
with "vendor_perl::" prefix for these modules. I think the problem
exists with all recent Fedora and Mandriva distros.
Also in some installations some paths in @INC are non-existent out of
the box. The following patch fixes the problem for me:
--- Tk-Pod-0.9929/Pod/FindPods.pm- 2004-09-08 21:08:44 +0000
+++ Tk-Pod-0.9929/Pod/FindPods.pm 2005-07-16 22:59:51 +0000
@@ -130,7 +130,7 @@ sub pod_find {
@dirs = @{ $args{-directories} };
@script_dirs = ();
} else {
- @dirs = grep { $_ ne '.' } @INC; # ignore current directory
+ @dirs = sort { length($b) <=> length($a) } grep { $_ ne '.' } @INC; # ignore current directory
@script_dirs = ($Config{'scriptdir'});
}
@@ -233,6 +233,7 @@ sub pod_find {
}
foreach my $inc (@dirs) {
+ next unless -d $inc;
$curr_dir = $inc;
find({ %opts, wanted => $wanted }, $inc);
}
@@ -277,6 +278,7 @@ sub guess_architectures {
my %arch;
my @configs;
foreach my $inc (@INC) {
+ next unless -d $inc;
if (!opendir(DIR, $inc)) {
warn "Can't opendir $inc: $!";
next;
End of patch
--
Alexey Tourbin
ALT Linux Team