PERL and LIBCURL

Does anyone have a simpe PERL script that calls libcurl command and print the output.
munzerAsked:
Who is Participating?
 
nayernaguibCommented:
Take a look at the example on the following page:

  http://curl.haxx.se/mail/lib-2003-07/0014.html

______________

  Nayer Naguib
0
 
munzerAuthor Commented:
IT does not seem to work under active state perl 5.8

I get this:

Bareword "CURLOPT_HEADERFUNCTION" not allowed while "strict subs" in use at test4.pl line 21.
Bareword "CURLOPT_WRITEFUNCTION" not allowed while "strict subs" in use at test4.pl line 22.
Bareword "CURLOPT_HTTPHEADER" not allowed while "strict subs" in use at test4.pl line 27.
Bareword "CURLOPT_FILE" not allowed while "strict subs" in use at test4.pl line 28.
Bareword "CURLOPT_URL" not allowed while "strict subs" in use at test4.pl line 32.
Execution of test4.pl aborted due to compilation errors.
0
 
nayernaguibCommented:
In order to access libcurl from Perl, you need to install an interface package, such as WWW::Curl, which is required by the above example. Take a look at the following page:

  http://curl.haxx.se/libcurl/perl/

______________

  Nayer Naguib
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
munzerAuthor Commented:
I did install it before I tried running the script.
0
 
nayernaguibCommented:
The errors above indicate that the Perl interpreter was indeed able to locate the file easy.pm under the path WWW/Curl, because otherwise the following error would have been displayed:

Can't locate WWW/Curl/easy.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at example.pl line 4.

However, the errors also indicate that the file easy.pm does not export libcurl function names, which is why the interpreter thinks that function names in your file are "barewords" and not functions (barewords are strings without surrounding single quotes). You need to follow the installation instructions on the page posted above. Take a look at the following page and compare the file easy.pm to WWW/Curl/easy.pm on your local file system:

  http://www.koders.com/perl/fid50DCD11E38F3A37C3437E8F713DFEA2349C99D7A.aspx

It will give you an indication of how the file should look like.

______________

  Nayer Naguib

0
 
PelicanPartsCommented:
I wasted an hour on this tonight - solution was to change use WWW:Curl:easy to WWW:Curl:Easy (uppercase Easy), and then it worked.  Must be a bug in Perl or something that it found the .pm modules, but didn't assign the namespace...

-Wayne
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.