Reputation: 805
I have ActivePerl 5.14.2 on my Windows machine. I have been trying to install the LWP cURL module. I have already installed the libcurl-dev library and GCC on my machine.
I also understand that LWP cURL has a dependency on the WWW-Curl-Easy module. So I installed that too. I installed all these through the command lines using the steps given in the Readme files. I ran the perl makefile.pl
command followed by a make
and a make install
. No errors were given out during the installation.
I am trying to execute this sample code to test my LWP cURL installation:
use LWP::Curl;
use strict;
use warnings;
my $lwpcurl = LWP::Curl->new();
my $content = $lwpcurl->get('http://search.cpan.org','http://www.cpan.org');
I am receiving the below error:
Can't locate loadable object for module WWW::Curl in @INC (@INC contains: C:/Perl64/site/lib C:/Perl64/lib .) at C:/Perl64/site/lib/WWW/Curl.pm line 11. BEGIN failed--compilation aborted at C:/Perl64/site/lib/WWW/Curl.pm line 11. Compilation failed in require at C:/Perl64/site/lib/WWW/Curl/Easy.pm line 9. Compilation failed in require at C:/Perl64/site/lib/LWP/Curl.pm line 5. BEGIN failed--compilation aborted at C:/Perl64/site/lib/LWP/Curl.pm line 5. Compilation failed in require at D:\Varsha\Curl.pl line 1. BEGIN failed--compilation aborted at D:\Varsha\Curl.pl line 1.
Where am I going wrong?
Upvotes: 4
Views: 5127
Reputation: 35198
This is probably not the direction you want to go, but I'd advise you to consider upgrading your perl and changing distributions:
Strawberry Perl
- 5.18.2.2 is the currently recommended version.cpanm
: perl -MCPAN -e "install App::cpanminus"
LWP::Curl
: cpanm LWP::Curl
I won't bother trying convince you of the change, but Strawberry Perl and cpanm
in combination make installing modules a lot easier than having to dealing with the proprietary ppm's of ActivePerl
in my opinion.
Just something to consider if you ever get tired of the occasional headaches.
Upvotes: 1
Reputation: 21666
The error means that WWW::Curl
is either not installed or its path is not searchable (it's not in @INC). So the solutions are
set PERL5LIB = c:\path\to\dir
For a permanent solution follow the below:
Right-click My Computer and click Properties.
In the System Properties window, click on the Advanced tab.
In the Advanced section, click the Environment Variables button.
In the Environment Variables window in the "User variables for Foo Bar" section click on New and type in the following:
Variable name: PERL5LIB
Variable value: c:\path\to\dir
Then click OK 3 times. Windows that you open after this will already know about the new variable. Type this in the command window, to see the newly set value:
echo %PERL5LIB%
This will add the private /home/foobar/code directory (or c:\path\to\dir directory) to the beginning of @INC for every script that is executed in the same environment.
Also see: Installing perl dependency automatically in perl
Upvotes: 0