develooper Front page | perl.perl5.porters | Postings from July 2003

Moving $Config{scriptdirexp} to the end of the perldoc search list

Thread Next
Michael G Schwern
July 30, 2003 23:18
Moving $Config{scriptdirexp} to the end of the perldoc search list
Message ID:
I got a surprising result with perldoc on OS X just now:

"perldoc CPAN" brought up...

CPAN(1)        User Contributed Perl Documentation        CPAN(1)

       cpan - easily interact with CPAN from the command line

               # 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  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 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/	2003/07/31 05:49:57	1.1
+++ lib/Pod/	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) {

Stupid am I?  Stupid like a fox!

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About