I got a surprising result with perldoc on OS X just now:
"perldoc CPAN" brought up...
CPAN(1) User Contributed Perl Documentation CPAN(1)
NAME
cpan - easily interact with CPAN from the command line
SYNOPSIS
# with arguments, installs specified modules
cpan module_name [ module_name ... ]
"perldoc -l CPAN" and "perldoc -m CPAN" showed that perldoc found
/usr/bin/cpan instead of CPAN.pm. This is perldoc 3.08 and 3.09.
This surprising result is because perldoc, before checking @INC, checks
$Config{scriptdirexp}. A feature I'd never realized it had, but it seems
to have been doing this for a while. Coupled with my case-insensitive
filesystem it caused it to pick up /usr/bin/cpan before the CPAN.pm module.
I'd argue that perldoc should err on the side of modules over scripts.
The following patch moves $Config{scriptdirexp} to the end of perldoc's
search path.
--- lib/Pod/Perldoc.pm 2003/07/31 05:49:57 1.1
+++ lib/Pod/Perldoc.pm 2003/07/31 05:50:01
@@ -698,7 +698,7 @@
# We must look both in @INC for library modules and in $bindir
# for executables, like h2xs or perldoc itself.
- my @searchdirs = ($self->{'bindir'}, @INC);
+ my @searchdirs = (@INC, $self->{'bindir'});
unless ($self->opt_m) {
if (IS_VMS) {
my($i,$trn);
--
Stupid am I? Stupid like a fox!