0

I'm noob in perl.

I used perl module installed on /usr/lib/perl5/site_perl on CentOS 5. On CentOS 6 the directory is missing from perl search path (@INC).

On CentOS 5 perl -V output:

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  .......
  .......
  Built under linux
  Compiled at Sep  3 2009 10:26:51
  @INC:
    /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi
    /usr/lib/perl5/site_perl/5.8.8
    /usr/lib/perl5/site_perl
    /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi
    /usr/lib/perl5/vendor_perl/5.8.8
    /usr/lib/perl5/vendor_perl
    /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi
    /usr/lib/perl5/5.8.8
    .

On CentOS 6 perl -V output:

Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
  .....
  .....
  Built under linux
  Compiled at Jun 22 2012 13:27:28
  @INC:
    /usr/local/lib64/perl5
    /usr/local/share/perl5
    /usr/lib64/perl5/vendor_perl
    /usr/share/perl5/vendor_perl
    /usr/lib64/perl5
    /usr/share/perl5
    .

Where should I put arch independent stuff now?

dimba
  • 26,717
  • 34
  • 141
  • 196

2 Answers2

2

If you are using a CPAN module then you should let the cpan utility decide where to put the files when the package is installed.

If you have written the module yourself then you can put the code in the current working directory (you will see that . is the last item in @INC) or in a separate directory specified by the environment variable PERL5LIB or in the Perl source file with use lib.

It is a bad idea to put development modules in a directory that is in every user's @INC list.

If you need a separate permanent directory for site libraries then you should rebuild Perl with an additional library path.

Borodin
  • 126,100
  • 9
  • 70
  • 144
2

Plain perl modules specific to your site should go in the directory given by:

perl -V:installsitelib

Consider creating a Makefile.PL or Build.PL and using that to install your module; doing

module-starter --module Your::Module::Name --author 'Your Name' --email your.email@example.com

will use module-starter to create a template distribution you can copy your code into.

ysth
  • 96,171
  • 6
  • 121
  • 214
  • Yes, except that there may not be one, and it looks like there isn't in this case. – Borodin Mar 06 '13 at 08:14
  • @Borodin: really? I would guess it is /usr/local/share/perl5 (and /usr/local/lib64/perl5 is likely installsitearch) – ysth Mar 06 '13 at 08:16
  • @ysthThis exactly what I was looking for. I needed to install pm while building rpm -apparently there's predefined variable %{perl_sitelib}, which uses "perl -V:installsitelib" (see https://github.com/akozumpl/rpm/blob/master/macros.in) – dimba Mar 07 '13 at 12:50