On Sunday, March 31, 2002, at 04:27 , Jonathan E. Paton wrote:
[..]
>
>> By the way, why there is a folder call LIB
>> while other one is Site/Lib , but they just
>> put modules too...... any difference ?
>
> Only speculating:
[ really well reasoned argument deleted ]
{ this is probably 'deep background' for most - but it
will help, I hope, explain some of the differences. }
{ we pause for a brief FREAK OUT! }
there is the 'version skew' problem that worries me
about Jonathan's approach - since I recently read on
another group where they were trying to find the <FOO>::<BAR>
package - and were running into the problem that some of that
was installed into
/opt/apache/lib/.....
others in
/opt/lib/perl5/....
So there is some 'ugly' that can come into play when you
start skewing how things are installed and where.
{ I think they may also have had the usual horror of /usr/bin/perl
not being the same as /usr/local/bin/perl - with one built with
the prefix set to /opt/lib/perl5 the other for /opt/apache....
Trust me this HURTS. }
So it is always best to check the perl -V output to see where
it will naturally look for modules - the end bit is where you
check what it sees as the @INC, eg:
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under solaris
Compiled at Dec 26 2001 15:09:36
@INC:
/usr/local/lib/perl5/5.6.1/i86pc-solaris
/usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/i86pc-solaris
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl/5.005/i86pc-solaris
/usr/local/lib/perl5/site_perl/5.005
/usr/local/lib/perl5/site_perl
.
or simply do
[jeeves:~] drieux% perl -e 'print "$_ \n" foreach (@INC);'
/System/Library/Perl/darwin
/System/Library/Perl
/Library/Perl/darwin
/Library/Perl
/Library/Perl
/Network/Library/Perl/darwin
/Network/Library/Perl
/Network/Library/Perl
.
[jeeves:~] drieux%
#-----------------
Secondly folks should also remember that some modules require that
there be [OS|REV|ARCH] specific compiled shared libraries
or dll's installed in specific places.
eg:
vladimir: 70:] find . -name "MD5*"
../site_perl/5.005/sun4-solaris/auto/Digest/MD5
../site_perl/5.6.1/sun4-solaris/auto/Digest/MD5
../site_perl/5.6.1/sun4-solaris/auto/Digest/MD5/MD5.so
../site_perl/5.6.1/sun4-solaris/auto/Digest/MD5/MD5.bs
../site_perl/5.6.1/sun4-solaris/Digest/MD5.pm
the MD5.so is a compiled binary that is different on the
above solaris sparc box, than it is on the linux box, than ....
{ under darwin you want to look for the *.bundle files... }
while other PM's do not have an OS specific requirement:
vladimir: 71:] find . -name "Tree*"
../site_perl/5.6.1/HTML/TreeBuilder.pm
../site_perl/5.6.1/HTML/Tree.pm
../site_perl/5.6.1/HTML/Tree
vladimir: 72:]
The third case of course is the mix and match:
disky: 57:] find . -name "llyrisWeb*"
../site_perl/5.6.0/i386-linux/auto/Wetware/llyrisWeb
../site_perl/5.6.0/auto/Wetware/llyrisWeb
../site_perl/5.6.0/Wetware/llyrisWeb.pm
disky: 58:]
where there are some autoload modules.....
{ see also prior kvetch about installation with package managers }
#-----------------------------------
thirdly - if one just whacked in the
llyrisWeb.pm into say
./site_perl
but called it out in your script with:
require Wetware::llyrisWeb;
&Wetware::llyrisWeb::parse_cmd_line(@ARGV);
then you would get the error:
vladimir: 76:] perl !$
perl skank.cgi
Can't locate Wetware/llyrisWeb.pm in @INC (@INC contains:
/usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .) at
skank.cgi line 36.
vladimir: 77:] ls -l /usr/local/lib/perl5/site_perl/llyrisWeb.pm
-rw-r--r-- 1 root other 6909 Mar 31 09:13 /usr/local/lib/perl5/
site_perl/llyrisWeb.pm
vladimir: 78:]
if one were to have put it into say
"$ENV{'HOME'}/lib/perl";
and used the
use lib "$ENV{'HOME'}/lib/perl";
you will get the new and improved error:
vladimir: 79:] perl skank.cgi
Can't locate auto/Wetware/llyrisWeb/autosplit.ix in @INC (@INC contains:
/home/drieux/lib/perl /usr/local/lib/perl5/5.6.1/sun4-solaris
/usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .) at
/usr/local/lib/perl5/5.6.1/AutoLoader.pm line 146.
at /home/drieux/lib/perl/Wetware/llyrisWeb.pm line 8
running In command line mode with
Can't locate auto/Wetware/llyrisWeb/parse_cmd_l.al in @INC (@INC contains:
/home/drieux/lib/perl /usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/
lib/perl5/5.6.1 /usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .) at
skank.cgi line 41
vladimir: 80:]
etc, etc, etc....
#--------------------------------
Fourthly folks can work around some of this with the 'use lib'
setting in their perl scripts with something like:
use lib "$ENV{'HOME'}/lib/perl"; #- a unix style trick
for prepending where they have put their <FOO>::<BAR> Perl Module
package - I use this for developing some of my modules -
by putting them in that directory till I squash out the
typo's and bad reasoning.... first in the module, then
in the scripts...
but as I noted above - this ONLY WORKS if you are doing
simple perl modules - and/or make sure to 'install' them
correctly - and not merely parts of them.
ciao
drieux
---
ps: there are only two things I 'hate' -
drug addled codeMonkey's with no idea how it will install
in the real world.
JackBootedFascistSysAdds with excessive control freak tendencies
about how things Must be installed.
my therapist says I may still learn to like one or the other sides of me.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]