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
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 cpanm
to install it:
$ cpanm WWW::Curl
See also perldoc perlmodinstall
.
You have installed the curl library. To install the WWW::Curl module do this:
yum install perl-WWW-Curl
I am going to ignore that chaos that I see and simply answer the question:
@INC
, you add directories. The directories you add contain Perl modules, ie *.pm
files. use lib
. If the directory you want to add is /foo/bar
: use lib qw| /foo/bar |;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.