3

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?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Amritha
  • 795
  • 3
  • 9
  • 26
  • I am sure that `WWW::Curl` hasn't been installed properly. If I try it myself I get the message `Sorry, no automated install is available on Windows, please see the file on instructions for a manual install.` Did you read `README.Win32`? It says that you have to edit `Makefile.PL`, and have curl already installed – Borodin Jun 03 '14 at 03:56
  • is `curl` required? doesn't `LWP::Simple`'s get() do the same? Maybe you have a special reason for using curl, but just thought I'd point out that `LWP::Simple`, or `LWP::UserAgent` should be all you need. – Gabs00 Jun 03 '14 at 04:02
  • @Borodin I did manually install Curl after following the instructions in the Readme file. I am also pretty sure this is some path/installation problem. Will try it out again ! – Amritha Jun 03 '14 at 04:12

2 Answers2

1

This is probably not the direction you want to go, but I'd advise you to consider upgrading your perl and changing distributions:

  • Install Strawberry Perl - 5.18.2.2 is the currently recommended version.
  • Install cpanm: perl -MCPAN -e "install App::cpanminus"
  • Install 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.

Miller
  • 34,962
  • 4
  • 39
  • 60
0

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

  1. Make sure that the module is installed.
  2. Add the path where the module is installed to the @INC. Since you are on Windows, you can use 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

Community
  • 1
  • 1
Chankey Pathak
  • 21,187
  • 12
  • 85
  • 133