in reply to Packaging Libraries before deploying my Scripts.

To use a custom location for libraries, put

use lib '/wherever/you/want';
at the top of your script.

As for packaging libs with your script, the approach you've outlined won't work. When you install a Perl lib via make it will be built for the system it's being built on. Some modules are simple enough that they can be picked up and moved, but most not.

There are many ways to solve your problem, from packaging a self-contained app, to including a README with instructions on how to get missing libs. It depends on your users' ability, mostly.

The way forward always starts with a minimal test.

Replies are listed 'Best First'.
Re^2: Packaging Libraries before deploying my Scripts.
by ArunMKumar (Initiate) on Oct 25, 2016 at 12:24 UTC
    I want to clarify something here... '/wherever/you/want/' is the same as my <path_to_lib> and not any subdirectories in it..

    Regarding the secong point you mentioned, even I thought the same, I think I would create a simple bash script which will do the installation of these libraries. I will pack the tar files in the project directories as of now.

    and thanks, I will add a README.

    Appreciate the help..

      It's perhaps worth pointing out that some modules are wrappers around external libraries, e.g. XML::LibXML is an interface on libxml2. You'd need to ensure that the required libraries and so on are available on the target machines. An alternative idea worth considering would be packaging your scripts and their dependencies into an executable using something like PAR/pp, e.g. on my 64bit Debian system:

      #!/usr/bin/perl use strict; use warnings; use XML::LibXML; use Spreadsheet::ParseExcel; print "test\n";

      Packaged to an executable Packaged via:

      pp -x -o Packaged \ -l /usr/lib/x86_64-linux-gnu/libicudata.so \ -l /usr/lib/x86_64-linux-gnu/libxml2.so \ -l /usr/lib/x86_64-linux-gnu/libicuuc.so \ source.pl

      Yep. If you have some libs you made like:

      /home/fred/perl/lib/ModuleName.pm /home/fred/perl/lib/ModuleName/Extend.pm /home/fred/perl/lib/OtherModule.pm
      You only need to say:
      use lib '/home/fred/perl/lib'; use ModuleName::Extend; use OtherModule;

      The way forward always starts with a minimal test.