Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Using www::curl

by almut (Canon)
on Apr 19, 2007 at 14:34 UTC ( [id://610960]=note: print w/replies, xml ) Need Help??


in reply to Using www::curl

Can't locate loadable object for module WWW::Curl ... (...)
I have downloaded and make'd WWW::Curl, and it is in the library location i have specified

Some background info, as this is a commonly occurring problem when installing modules into a private location:  There are two types of modules: architeture-independent (pure Perl) and architecture-specific ones (XS modules, i.e. a binding to some C library (typically in the form of a shared object (.so) file).

WWW::Curl is an architecture-specific one. This means you need to take a bit more care, if you manually build and install the files. The easiest way to set things up properly in some private lib dir is to put all files into a directory structure that Perl normally expects to find (I say normally, because there are of course ways to tweak things...).

If you add an additional lib path with use lib '/path/to/perllib';, there should be two directory branches - you guessed it: an architecture-independent one, and an architecture-specific one. The former is the lib path as specified (i.e. /path/to/perllib/), and the latter is a subdirectory therein: /path/to/perllib/arch/, where "arch" is the actual architecture name, e.g. something like x86_64-linux-thread-multi1. Architecture-specific modules consist of two parts, the .pm file (Perl code), and the .so file (actual XS/C binding; binary, compiled code). The .so files go below an arch/auto subdirectory. So, for WWW::Curl you should have a structure something like this:

$ find /home/lsrfm/webs/www.lsrfm.com/perllib /home/lsrfm/webs/www.lsrfm.com/perllib /home/lsrfm/webs/www.lsrfm.com/perllib/mach /home/lsrfm/webs/www.lsrfm.com/perllib/mach/auto /home/lsrfm/webs/www.lsrfm.com/perllib/mach/auto/WWW /home/lsrfm/webs/www.lsrfm.com/perllib/mach/auto/WWW/Curl /home/lsrfm/webs/www.lsrfm.com/perllib/mach/auto/WWW/Curl/Curl.bs /home/lsrfm/webs/www.lsrfm.com/perllib/mach/auto/WWW/Curl/Curl.so /home/lsrfm/webs/www.lsrfm.com/perllib/mach/auto/WWW/Curl/.exists /home/lsrfm/webs/www.lsrfm.com/perllib/mach/WWW /home/lsrfm/webs/www.lsrfm.com/perllib/mach/WWW/Curl /home/lsrfm/webs/www.lsrfm.com/perllib/mach/WWW/Curl/Multi.pm /home/lsrfm/webs/www.lsrfm.com/perllib/mach/WWW/Curl/Form.pm /home/lsrfm/webs/www.lsrfm.com/perllib/mach/WWW/Curl/Easy.pm /home/lsrfm/webs/www.lsrfm.com/perllib/mach/WWW/Curl.pm

The lib pragma automatically adds the appropriate architecture-specific subdirectory to @INC, in addition to the toplevel lib dir you specify. From the docs:

For each directory in LIST (called $dir here) the lib module also checks to see if a directory called $dir/$archname/auto exists. If so the $dir/$archname directory is assumed to be a corresponding architecture specific directory and is added to @INC in front of $dir.

You can verify this doing

perl -Mlib=/home/lsrfm/webs/www.lsrfm.com/perllib -V

Should produce, in the @INC section of the output (and if there is an mach/auto directory):

@INC: /home/lsrfm/webs/www.lsrfm.com/perllib/mach /home/lsrfm/webs/www.lsrfm.com/perllib (...)

___

1  In your case this seems to be mach (kind of generic, but why not :) -- In case of doubt you can ask Perl: perl -V | grep archname (capital V, btw). Look for archname=...

Update: or even shorter (thanks, Corion :)

perl -V:archname

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://610960]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-24 03:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found