Reputation: 91
I want to include a local module in a Perl script that's not installed. The code below seems to work for that purpose. However, the module I want to include is a wrapper for a C library. I do it as follows:
use FindBin;
use lib "$FindBin::Bin/gray-tree-suffix-59e1c06/lib";
use Tree::Suffix;
The Perl module is called Tree::Suffix and acts as a wrapper for libstree. My question is, how do I reference the C library locally as well (given that it's not installed).
I presume it would have something to do with the inner workings of the Perl module? I apologise if this is an amateurish question. Thank you!
Upvotes: 1
Views: 165
Reputation: 11
Have you tried this :
say the .so
file is foo.so
, and its full path is /bar/baz/foo.so
:
BEGIN
{
$ENV{LD_LIBRARY_PATH} = '/bar/baz:'.$ENV{LD_LIBRARY_PATH};
}
use FindBin;
use lib "$FindBin::Bin/gray-tree-suffix-59e1c06/lib";
use Tree::Suffix;
or, alternatively, change the shell's LD_LIBRARY_PATH
before your Perl program is called :
export LD_LIBRARY_PATH=/bar/baz:$LD_LIBRARY_PATH
[run your program]
Upvotes: 1