kdjantzen has asked for the wisdom of the Perl Monks concerning the following question:

I have a problem locating modules in my directories: I have a directory MyModules where all modules of all applications are stored (possibly not a very sophisticated setup) and a directory MyTest where there are the modules of one application that are being changed.
At the beginning of the calling program there is a 'use lib "MyTest MyModules"'

Going throught "perldoc lib" I found the following "cryptic" sentence:

<doc>
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.
<\doc>

The error message shows that the two directories are included in the correct sequence. XXX.pm is definitively a module contained in the directory MyModules.

<msg>
Can't locate XXX.pm in @INC (@INC contains: /home/.../MyTest /home/.../MyModules /usr/lib/perl5/5.8.6/i586-linux-thread-multi /usr/lib/perl5/5.8.6 /usr/lib/perl5/site_perl/5.8.6/i586-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl .) at /home/.../yyyy line 31.
<\msg>

What do I have to do so that the modules are found wherever they are?

Is there some documentation about building libraries?

Thanks for any help.

Replies are listed 'Best First'.
Re: Locating modules in directories
by shmem (Chancellor) on Apr 21, 2007 at 12:15 UTC
    Saying
    use lib "MyTest MyModules"; # wrong - a string!

    is certainly wrong, that should be

    use lib qw(MyTest MyModules); # correct - a list.
    But then, your @INC path list seems correct; probably you said
    use lib "/home/.../MyTest /home/.../MyModules"

    in the script version which produced that output. So what looks like two directories is just one - with a blank in it :-P

    To illustrate:

    qwurx [shmem] > perl -le 'use lib "MyTest MyModules"; print for @INC' MyTest MyModules /home/shmem/perl/lib /usr/lib/perl5/5.8.8/i586-linux-thread-multi /usr/lib/perl5/5.8.8 /usr/lib/perl5/site_perl/5.8.8/i586-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i586-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      shmem, thank you very much for the fast reply: that was it!
Re: Locating modules in directories
by chromatic (Archbishop) on Apr 21, 2007 at 23:54 UTC
    Going throught "perldoc lib" I found the following "cryptic" sentence:

    That sentence describes information important to modules with compiled components--XS modules. Until you write your own, you can mostly ignore it. As long as the only XS modules you use come from vendor packages, are core modules, or use ExtUtils::MakeMaker or Module::Build and the standard CPAN module installation process, you can continue to ignore it.

Re: Locating modules in directories
by betterworld (Curate) on Apr 21, 2007 at 14:05 UTC
    Is there some documentation about building libraries?
    There's perldoc perlmod.