Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"perldoc lib" doesn't describe actual behavior of "use lib" #7825

Closed
p5pRT opened this issue Mar 4, 2005 · 11 comments
Closed

"perldoc lib" doesn't describe actual behavior of "use lib" #7825

p5pRT opened this issue Mar 4, 2005 · 11 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 4, 2005

Migrated from rt.perl.org#34339 (status was 'resolved')

Searchable as RT34339$

@p5pRT
Copy link
Author

p5pRT commented Mar 4, 2005

From web-perl@tarsier.net

Created by web-perl@tarsier.net

On perl 5.8.6 (as well as 5.8.4 and 5.6.1), the perldoc documentation
for "use lib" doesn't include an accurate description of what gets
added to @​INC. In reality (taken from /usr/local/lib/perl5/5.8.4/i386-freebsd/lib.pm)

  my($arch_auto_dir, $arch_dir, $version_dir, $version_arch_dir)
  = _get_dirs($path);
  unshift(@​INC, $arch_dir) if -d $arch_auto_dir;
  unshift(@​INC, $version_dir) if -d $version_dir;
  unshift(@​INC, $version_arch_dir) if -d $version_arch_dir;

The documentation (from the perldoc of the same file) says​:

  For each directory in LIST (called $dir here) the lib module also
  checks to see if a directory called $dir/$archname/auto exists.
  If so the $dir/$archname directory is assumed to be a corresponding
  architecture specific directory and is added to @​INC in front of $dir.

It should mention something about $dir/$version/$archname and $dir/$version
being added before $arch_dir, irregardless of /auto directories.

Perl Info

Flags:
    category=docs
    severity=low

Site configuration information for perl v5.8.4:

Configured by mfasman at Mon Oct  4 21:20:19 EDT 2004.

Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
  Platform:
    osname=freebsd, osvers=5.2.1-release-p6, archname=i386-freebsd
    uname='freebsd hcs.harvard.edu 5.2.1-release-p6 freebsd 5.2.1-release-p6 #0: sat jul 31 16:35:34 edt 2004 root@:usrsrcsysi386compilehcs i386 '
    config_args='-de'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include',
    optimize='-O',
    cppflags='-DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='3.3.3 [FreeBSD] 20031106', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags ='-Wl,-E  -L/usr/local/lib'
    libpth=/usr/lib /usr/local/lib
    libs=-lm -lcrypt -lutil -lc
    perllibs=-lm -lcrypt -lutil -lc
    libc=, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-DPIC -fPIC', lddlflags='-shared  -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.8.4:
    /usr/local/lib/perl5/5.8.4/i386-freebsd
    /usr/local/lib/perl5/5.8.4
    /usr/local/lib/perl5/site_perl/5.8.4/i386-freebsd
    /usr/local/lib/perl5/site_perl/5.8.4
    /usr/local/lib/perl5/site_perl/5.6.1
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.8.4:
    HOME=/usr/home/people/philz
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/usr/home/people/philz/bin:/usr/home/people/philz/pub/bin:/usr/local/zsh-4.0.6/bin:/usr/local/mutt-1.4/bin:/usr/local/vim61/bin:/usr/local/bin:/usr/local/sbin:/usr/sbin:/bin:/sbin:/usr/bin:/usr/X11/bin:/usr/games
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/zsh

@p5pRT
Copy link
Author

p5pRT commented Jun 25, 2008

From renee.baecker@smart-websolutions.de

Attached is a patch for lib_pm.PL

--
Renée Bäcker
renee.baecker@​smart-websolutions.de

XING​: http​://www.xing.com/profile/Renee_Baecker
Foo-Magazin​: http​://foo-magazin.de

@p5pRT
Copy link
Author

p5pRT commented Jun 25, 2008

From renee.baecker@smart-websolutions.de

34339.patch
--- lib_pm.PL.orig	2008-06-25 13:58:11.000000000 +0200
+++ lib_pm.PL	2008-06-25 13:57:11.000000000 +0200
@@ -223,11 +223,17 @@
 checks to see if a directory called $dir/$archname/auto exists.
 If so the $dir/$archname directory is assumed to be a corresponding
 architecture specific directory and is added to @INC in front of $dir.
+lib.pm also checks if directories called $dir/$version and $dir/$version/$archname
+exist and adds these directories to @INC.
 
 The current value of C<$archname> can be found with this command:
 
     perl -V:archname
 
+The corresponding command to get the current value of C<$version> is:
+
+    perl -V:version
+
 To avoid memory leaks, all trailing duplicate entries in @INC are
 removed.
 

@p5pRT
Copy link
Author

p5pRT commented Jun 25, 2008

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jun 25, 2008

From @Tux

On Wed, 25 Jun 2008 16​:40​:57 +0200, Renée Bäcker
<renee.baecker@​smart-websolutions.de> wrote​:

Attached is a patch for lib_pm.PL

I would shorten that a bit to

Inline Patch
--- lib_pm.PL.orig	2008-06-25 13:58:11.000000000 +0200
+++ lib_pm.PL	2008-06-25 13:57:11.000000000 +0200
@@ -223,11 +223,17 @@
 checks to see if a directory called $dir/$archname/auto exists.
 If so the $dir/$archname directory is assumed to be a corresponding
 architecture specific directory and is added to @INC in front of $dir.
+lib.pm also checks if directories called $dir/$version and
+$dir/$version/$archname exist and adds these directories to @INC.
 
-The current value of C<$archname> can be found with this command:
+The current values of C<$version> and C<$archname> can be found with
+this command: 
 
-    perl -V:archname
+    perl -V:version\|archname
 
 To avoid memory leaks, all trailing duplicate entries in @INC are
 removed.

-- 

H.Merijn Brand Amsterdam Perl Mongers http​://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Jun 26, 2008

From @rgs

2008/6/25 H.Merijn Brand <h.m.brand@​xs4all.nl>​:

On Wed, 25 Jun 2008 16​:40​:57 +0200, Renée Bäcker
<renee.baecker@​smart-websolutions.de> wrote​:

Attached is a patch for lib_pm.PL

I would shorten that a bit to

--- lib_pm.PL.orig 2008-06-25 13​:58​:11.000000000 +0200
+++ lib_pm.PL 2008-06-25 13​:57​:11.000000000 +0200
@​@​ -223,11 +223,17 @​@​
checks to see if a directory called $dir/$archname/auto exists.
If so the $dir/$archname directory is assumed to be a corresponding
architecture specific directory and is added to @​INC in front of $dir.
+lib.pm also checks if directories called $dir/$version and
+$dir/$version/$archname exist and adds these directories to @​INC.

-The current value of C<$archname> can be found with this command​:
+The current values of C<$version> and C<$archname> can be found with
+this command​:

- perl -V​:archname
+ perl -V​:version\|archname

This syntax (\|) is probably not very portable across command-line
interfaces, though.

@p5pRT
Copy link
Author

p5pRT commented Jun 26, 2008

From @nwc10

On Wed, Jun 25, 2008 at 04​:40​:57PM +0200, Rene Bcker wrote​:
Hmm, my mutt is being hateful ^ ^

Attached is a patch for lib_pm.PL

The current value of C<$archname> can be found with this command​:

 perl \-V&#8203;:archname

+The corresponding command to get the current value of C<$version> is​:
+
+ perl -V​:version
+
To avoid memory leaks, all trailing duplicate entries in @​INC are
removed.

Aside - are we really avoiding leaks, or just avoiding waste?

On Wed, Jun 25, 2008 at 06​:51​:14PM +0200, H.Merijn Brand wrote​:

On Wed, 25 Jun 2008 16​:40​:57 +0200, Renée Bäcker
<renee.baecker@​smart-websolutions.de> wrote​:

Attached is a patch for lib_pm.PL

I would shorten that a bit to

-The current value of C<$archname> can be found with this command​:
+The current values of C<$version> and C<$archname> can be found with
+this command​:

- perl -V​:archname
+ perl -V​:version\|archname

Arguably I'm bikeshedding too, but I prefer Renée's. Yours assumes Unix shell
quoting rules. I'm not sure whether \| will do the same thing on the various
Win32 shells, VMS, or other places. Also, I think I prefer his KISS, even if
it is a bit more verbose. It doesn't introduce 2 concepts at once.

Nicholas Clark

@p5pRT
Copy link
Author

p5pRT commented Jun 26, 2008

From @Tux

On Thu, 26 Jun 2008 08​:54​:04 +0200, "Rafael Garcia-Suarez"
<rgarciasuarez@​gmail.com> wrote​:

2008/6/25 H.Merijn Brand <h.m.brand@​xs4all.nl>​:

On Wed, 25 Jun 2008 16​:40​:57 +0200, Renée Bäcker
<renee.baecker@​smart-websolutions.de> wrote​:

Attached is a patch for lib_pm.PL

I would shorten that a bit to

--- lib_pm.PL.orig 2008-06-25 13​:58​:11.000000000 +0200
+++ lib_pm.PL 2008-06-25 13​:57​:11.000000000 +0200
@​@​ -223,11 +223,17 @​@​
checks to see if a directory called $dir/$archname/auto exists.
If so the $dir/$archname directory is assumed to be a corresponding
architecture specific directory and is added to @​INC in front of $dir.
+lib.pm also checks if directories called $dir/$version and
+$dir/$version/$archname exist and adds these directories to @​INC.

-The current value of C<$archname> can be found with this command​:
+The current values of C<$version> and C<$archname> can be found with
+this command​:

- perl -V​:archname
+ perl -V​:version\|archname

This syntax (\|) is probably not very portable across command-line
interfaces, though.

but I found it a bit verbose to repeat the same command line twice with
just another variable. Besides that, I also think it is worth promoting
the lesser widespread knowledge that -V​: takes a perl regex. What does
the documentation for 'perl -e' use?

  perl -V​:'version|archname'

Which won't work on windows or

  perl "-V​:version|archname"

which might break elsewhere (though for this pattern, I see no obvious
breakage, I tried *nix (tcsh & bash), Strawberry and Cygwin).

--
H.Merijn Brand Amsterdam Perl Mongers http​://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin.
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Jun 28, 2008

From @rgs

2008/6/25 Renée Bäcker <renee.baecker@​smart-websolutions.de>​:

Attached is a patch for lib_pm.PL

Thanks, applied.

@p5pRT
Copy link
Author

p5pRT commented Jun 29, 2008

From wyp3rlx02@sneakemail.com

Rafael Garcia-Suarez wrote​:

2008/6/25 Renée Bäcker <renee.baecker@​smart-websolutions.de>​:

Attached is a patch for lib_pm.PL

Thanks, applied.

Same for the CPAN release. The CPAN release is at 0.59 (instead of 0.57
in blead) because I had trouble getting the first version indexed by
PAUSE. Feel free to increment the version in blead accordingly.

Cheers,
Steffen

@p5pRT
Copy link
Author

p5pRT commented Jun 30, 2008

module@renee-baecker.de - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant