?
Solved

PERL and LIBCURL

Posted on 2007-07-21
6
Medium Priority
?
2,017 Views
Last Modified: 2013-12-25
Does anyone have a simpe PERL script that calls libcurl command and print the output.
0
Comment
Question by:munzer
  • 3
  • 2
6 Comments
 
LVL 14

Accepted Solution

by:
nayernaguib earned 2000 total points
ID: 19543342
Take a look at the example on the following page:

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

______________

  Nayer Naguib
0
 

Author Comment

by:munzer
ID: 19543394
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
 
LVL 14

Expert Comment

by:nayernaguib
ID: 19543676
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:munzer
ID: 19544941
I did install it before I tried running the script.
0
 
LVL 14

Expert Comment

by:nayernaguib
ID: 19547511
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
 

Expert Comment

by:PelicanParts
ID: 38162342
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

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Simple Linear Regression
Starting up a Project
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question