tags:

views:

179

answers:

3

I am running a script which requires the Curl.pm lib in order to work. I used YUM to install the library and now I am trying to have my script use it, but I keep getting the error

Can't locate WWW/Curl.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.6/x86_...

When I type the following in the command line:

rpm -ql curl

I get:

/usr/bin/curl
/usr/lib64/libcurl.so.3
/usr/lib64/libcurl.so.3.0.0
/usr/share/doc/curl-7.13.1
/usr/share/doc/curl-7.13.1/BUGS
/usr/share/doc/curl-7.13.1/CHANGES
/usr/share/doc/curl-7.13.1/COPYING
/usr/share/doc/curl-7.13.1/FAQ
 ...
/usr/share/man/man1/curl.1.gz
/usr/bin/curl
/usr/lib/libcurl.so.3
/usr/lib/libcurl.so.3.0.0
/usr/share/doc/curl-7.13.1
/usr/share/doc/curl-7.13.1/BUGS
/usr/share/doc/curl-7.13.1/CHANGES
... etc.

Which one of the paths above needs to be included in my @INC directory? I had thought that the code below would solve the problem when placed at the top of my script, but I am still getting the same error @INC error.

BEGIN {
  unshift(@INC, '/usr/lib/libcurl.so.3');
  use WWW::Curl;
}

When I type

cpan> i /WWW::curl/

I get the following list below. I'm still stumped. I want to use WWW::curl and I don't know which of the paths below (or above) to add to @INC ! It looks like it's already installed. What do I do from here?

cpan> i /WWW::curl/
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata 
Database was generated on Mon, 30 Nov 2009 02:55:47 GMT
Module          WWW::Curl       (S/SZ/SZBALINT/WWW-Curl-4.09.tar.gz)
Module          WWW::Curl::Easy (S/SZ/SZBALINT/WWW-Curl-4.09.tar.gz)
Module          WWW::Curl::Form (S/SZ/SZBALINT/WWW-Curl-4.09.tar.gz)
Module          WWW::Curl::Multi (S/SZ/SZBALINT/WWW-Curl-4.09.tar.gz)  
Module          WWW::Curl::Share (S/SZ/SZBALINT/WWW-Curl-4.09.tar.gz)
Module          WWW::Curl::Simple (A/AN/ANDREMAR/WWW-Curl-Simple-0.05.tar.gz)
Module          WWW::Curl::Simple::Request (A/AN/ANDREMAR/WWW-Curl-Simple-0.05.tar.gz)
7 items found
+7  A: 

You installed curl which is not the same thing as WWW::Curl.

You need to install the Perl module WWW::Curl. You should first search your OS specific package repositories for the module. If you cannot find it there, use cpan to install it:

$ cpan WWW::Curl

See also perldoc perlmodinstall.

Sinan Ünür
+7  A: 

You have installed the curl library. To install the WWW::Curl module do this:

yum install perl-WWW-Curl
Gurunandan
+1  A: 

I am going to ignore that chaos that I see and simply answer the question:

  1. You don't add libraries to @INC, you add directories. The directories you add contain Perl modules, i.e. *.pm files.
  2. To do that, you simply use use lib. If the directory you want to add is /foo/bar:

 

use lib qw| /foo/bar |;
innaM
@Manni It is hard to ignore the chaos, primarily because if the OP were to install `WWW::Curl` via either the OS specific package manager or `cpan`, adding paths to `@INC` would not be necessary. +1.
Sinan Ünür
Sinan: I took me two hours to get myself in the right state of mind to ingore the chaos. Thanks for the upvote.
innaM