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

I need to use Bio::Phylo::Forest and Bio::Phylo::Treedrawer modules from my code but they are based on perl5lib and not perllib. I need to use perl5li @INC locally. I exported @INC to local dir.

 export PERL5LIB=/home/my_code_folder

and trying to access it via code

use local::lib "/home/my_code_folder"

but somehow no success. The error shows

Attempting to create directory /home/my_code_folder. Permission denied at /usr/share/perl5/local/lib.pm line 255.

Replies are listed 'Best First'.
Re: Exporting perl5lib to local directory and using local::lib module to access it.
by Corion (Patriarch) on Sep 11, 2015 at 05:29 UTC

    Use either PERL5LIB or local::lib, don't mix them.

    Also, are you sure that the directory is named /home/my_code_folder and not /home/naren87/my_code_folder?

      Okay, if I am using local::lib, then should the module files downloaded from cpan be present in that dir? and what if the module like Bio::Phylo with multiple submodules is needed?

        I'm unclear on what you mean by "downloaded from CPAN". The setup of local::lib is documented with examples in local::lib. If you follow that setup, you should be able to install all modules using the cpan tool (or cpanm).

        Note that the documented setup in local::lib differs from what you have told us so far. Your setup claims /home/my_code_folder but local::lib documents /home/username/perl5/lib/perl5. You might want to reread the documentation in local::lib and compare that to your current setup.