Jane Wilkie
Jane Wilkie

Reputation: 1743

Where to find the perl shared objects directory?

I just purchased a commercial perl shared object that is really light on its documentation. Specifically it's an ".so" file and I know that it needs to go into whatever directory perl is using to find shared objects.

Normally I encounter ".pm" files and know how to install those with no problem, but this is the first time I have ever used something in perl where I had to install a ".so" file, or copy it to a directory.

Anyone know how I would find this directory? It's at a level of Perl's sausage making which I'm not familiar with (plus I'm a bacon gal anyway. LOL!). Janie

Update: (for more clarity). The company that sold this has the file named as "hcmodule.so". Their example perl script has a use pragma in it of "use hcmodule" and a call later as..

$retval = hcmodule( ........ <SNIP>..);

If this helps unmurky things a bit.

Upvotes: 3

Views: 3660

Answers (2)

Jonathan Leffler
Jonathan Leffler

Reputation: 753455

Perl loads shared objects from directories under its lib directory. In some installations of Perl, that will be the lib directory parallel to the bin directory where the main Perl binary is found. In some systems, it will be located elsewhere. For example, my own build of Perl (5.14.1 on MacOS X) says (part of output from perl -V):

@INC
/Users/jleffler/Perl/v5.14.1-64/lib/perl5/site_perl/5.14.1/darwin-2level
/Users/jleffler/Perl/v5.14.1-64/lib/perl5/site_perl/5.14.1
/Users/jleffler/Perl/v5.14.1-64/lib/perl5/5.14.1/darwin-2level
/Users/jleffler/Perl/v5.14.1-64/lib/perl5/5.14.1

On the other hand, the system Perl (5.12.3) says:

@INC:
/Library/Perl/5.12/darwin-thread-multi-2level
/Library/Perl/5.12
/Network/Library/Perl/5.12/darwin-thread-multi-2level
/Network/Library/Perl/5.12
/Library/Perl/Updates/5.12.3
/System/Library/Perl/5.12/darwin-thread-multi-2level
/System/Library/Perl/5.12
/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.12

The shared objects on MacOS X have a .bundle extension (instead of .so), and some of the bundles I have are:

.../lib/perl5/site_perl/5.14.1/darwin-2level/auto/DBD/Informix/Informix.bundle
.../lib/perl5/site_perl/5.14.1/darwin-2level/auto/DBD/SQLite/SQLite.bundle
.../lib/perl5/site_perl/5.14.1/darwin-2level/auto/DBI/DBI.bundle

The corresponding PM files are:

.../lib/perl5/site_perl/5.14.1/darwin-2level/DBD/Informix.pm
.../lib/perl5/site_perl/5.14.1/darwin-2level/DBD/SQLite.pm
.../lib/perl5/site_perl/5.14.1/darwin-2level/DBI.pm

In any case, Perl will expect to look for the .so file in a directory related to the name of the module. There should be install instructions, especially since you paid for it. There will be (at least) a shared object and a .pm file to be installed, in two related related directories.

Upvotes: 7

David W.
David W.

Reputation: 107030

Have you tried perl -V to see if it has the information you want? Do you have the environment variable LD_LIBRARY_PATH set?

I'm on Linux, and doing perl -V (uppercase V) showed that Perl libraries are in /usr/lib/perl/5.10 and a few other libraries.

Exactly what Perl *.so file did you purchase? I've never heard of someone selling Perl shared libraries.

Upvotes: 4

Related Questions