2

I am a PHP programmer and have just been assigned task to work on some Perls stuff - I need to install modules.

But can anybody clarify for me the difference between 'lib' and 'site\lib' when install modules. By what criterion is one module installed in one instead of the other?

Is this really relevant on Windows (sorry never worked on UNIX).

I am looking at using Strawberry Perl 5.12.2.0.

MikeSNnowhill
  • 51
  • 1
  • 6

3 Answers3

6

lib/ contains the modules that come with Perl. site/lib/ contains the module you've installed yourself. Perl itself doesn't make any distinction between the two.

If site/lib/ isn't empty for a fresh install, it's probably because Strawberry includes modules in their distro that aren't normally packaged with Perl. (I know ActivePerl does.)

ikegami
  • 367,544
  • 15
  • 269
  • 518
0

The most recent Strawberry Perl named: strawberry-perl-5.28.1.1-64bit-portable, show the locations specified by @INC to be:

  @INC:
    D:/myBuilds/strawberry-perl-5.28.1.1-64bit-portable/perl/site/lib
    D:/myBuilds/strawberry-perl-5.28.1.1-64bit-portable/perl/vendor/lib
    D:/myBuilds/strawberry-perl-5.28.1.1-64bit-portable/perl/lib

What goes into vendor... is still unknown...
(Feel free to edit this.)

not2qubit
  • 14,531
  • 8
  • 95
  • 135
0

SOmetimes it is relevant. Sometimes you have to set the env var PERL5LIB to "site\lib;lib", sometimes it's the other way around.

Example (valid as of April, 2011):

Perl 5.12 includes Try::Tiny 0.6.

If you were to install Test::Fatal, it wants Try::Tiny 0.7+.

So you have to update it from the CPAN: then you'd get Try::Tiny 0.09

but 0.09 will only get loaded when you tell perl to look in site\lib first.

knb
  • 9,138
  • 4
  • 58
  • 85
  • 1
    [The `site` directory comes first since Perl 5.12.](http://p3rl.org/perl5120delta#@INC_reorganization) – daxim Apr 03 '11 at 10:06
  • If some module is included in Perl core, it will be installed into lib/ and updated there (in 5.12 behavior is same, but planned to change). – Alexandr Ciornii Apr 03 '11 at 20:49
  • Just sayin that in places it might be worthwile to check @INC and/or PERL5LIB. I was puzzled just last week when I installed newest modules on a windows box with ActiveStateperl 5.12 and my script still did not compile. Turned out that my script set PERL5LIB so that site\lib came second. Maybe this helps the OP as well (Ikegami already provided a perfect answer at teh same time) – knb Apr 03 '11 at 22:39