summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes7
-rw-r--r--Curl.xs26
-rw-r--r--META.yml4
-rw-r--r--Makefile.PL5
-rw-r--r--SIGNATURE24
-rw-r--r--lib/WWW/Curl.pm30
-rw-r--r--lib/WWW/Curl/Easy.pm7
-rw-r--r--lib/WWW/Curl/Form.pm33
-rw-r--r--t/01basic.t4
-rw-r--r--template/Easy.pm.tmpl7
10 files changed, 106 insertions, 41 deletions
diff --git a/Changes b/Changes
index 32cc8ad..42889d8 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,11 @@
Revision history for the Perl binding of libcurl, WWW::Curl.
+4.12 Sun Jun 04 2010: - Balint Szilakszi <szbalint at cpan.org>
+
+ - Fixed WWW::Curl::Form (patch contributed by Michael Ing).
+ - Added CURLPROXY_* constants (patch by claes).
+ - Added the const_string method to provide access to constants in a non-bareword way.
+ - Fixed t/01basic.t test failure on older libcurl versions.
+
4.11 Fri Dec 18 2009: - Balint Szilakszi <szbalint at cpan.org>
- Fixed t/19multi.t for libcurl versions compiled with asyncronous dns resolution.
diff --git a/Curl.xs b/Curl.xs
index cfb711b..926ee13 100644
--- a/Curl.xs
+++ b/Curl.xs
@@ -62,8 +62,8 @@ typedef struct {
typedef struct {
- struct HttpPost * post;
- struct HttpPost * last;
+ struct curl_httppost * post;
+ struct curl_httppost * last;
} perl_curl_form;
@@ -218,11 +218,9 @@ static perl_curl_form * perl_curl_form_new()
static void perl_curl_form_delete(perl_curl_form *self)
{
-#if 0
if (self->post) {
curl_formfree(self->post);
}
-#endif
Safefree(self);
}
@@ -790,17 +788,16 @@ curl_easy_setopt(self, option, value)
RETVAL = curl_easy_setopt(self->curl, option, IoOFP(sv_2io(value)) );
break;
- /* not working yet...
+ /* not working yet... */
case CURLOPT_HTTPPOST:
if (sv_derived_from(value, "WWW::Curl::Form")) {
- WWW__Curl__form wrapper;
+ WWW__Curl__Form wrapper;
IV tmp = SvIV((SV*)SvRV(value));
- wrapper = INT2PTR(WWW__Curl__form,tmp);
+ wrapper = INT2PTR(WWW__Curl__Form,tmp);
RETVAL = curl_easy_setopt(self->curl, option, wrapper->post);
} else
croak("value is not of type WWW::Curl::Form");
break;
- */
/* Curl share support from Anton Fedorov */
#if (LIBCURL_VERSION_NUM>=0x070a03)
@@ -978,6 +975,11 @@ curl_easy_strerror(self, errornum)
MODULE = WWW::Curl PACKAGE = WWW::Curl::Form PREFIX = curl_form_
+int
+constant(name,arg)
+ char * name
+ int arg
+
void
curl_form_new(...)
PREINIT:
@@ -998,32 +1000,28 @@ curl_form_new(...)
XSRETURN(1);
void
-curl_form_add(self,name,value)
+curl_formadd(self,name,value)
WWW::Curl::Form self
char *name
char *value
CODE:
-#if 0
curl_formadd(&(self->post),&(self->last),
CURLFORM_COPYNAME,name,
CURLFORM_COPYCONTENTS,value,
CURLFORM_END);
-#endif
void
-curl_form_addfile(self,filename,description,type)
+curl_formaddfile(self,filename,description,type)
WWW::Curl::Form self
char *filename
char *description
char *type
CODE:
-#if 0
curl_formadd(&(self->post),&(self->last),
CURLFORM_FILE,filename,
CURLFORM_COPYNAME,description,
CURLFORM_CONTENTTYPE,type,
CURLFORM_END);
-#endif
void
curl_form_DESTROY(self)
diff --git a/META.yml b/META.yml
index bcd485c..15ef8c9 100644
--- a/META.yml
+++ b/META.yml
@@ -22,4 +22,6 @@ no_index:
- template
requires:
perl: 5.6.1
-version: 4.11
+resources:
+ repository: http://github.com/szbalint/WWW--Curl
+version: 4.12
diff --git a/Makefile.PL b/Makefile.PL
index 0e68dee..d40c7fb 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -9,6 +9,7 @@ author 'Cris Bailiff <c.bailiff+curl at devsecure.com>';
license 'MPL or MIT/X-derivate';
perl_version '5.006001';
no_index directory => 'template';
+repository 'http://github.com/szbalint/WWW--Curl';
# This is a hack. If you have libcurl installed, just specify curl.h below
# and comment out this line.
if ($^O ne 'MSWin32') {
@@ -110,6 +111,8 @@ if (!defined($curl_h)) {
$constants{CURLOPT_}->{$option} = $value;
} elsif ($_ =~ m/^\s*(CURLINFO_|CURLSHOPT_|CURL_LOCK_DATA_|CURLE_|CURL_NETRC_)(\w+)/) {
$constants{$1}->{$2} = $2;
+ } elsif ($_ =~ m/^\s*CURLPROXY_(\w+)\s*=\s*\d+/) {
+ $constants{CURLPROXY_}->{$1} = $1;
}
}
@@ -185,7 +188,7 @@ HERE
if ($line !~ m/^\@CURLOPT_INCLUDE\@/) {
print EASY_PM $line;
} else {
- for my $group (qw/CURLOPT_ CURLINFO_ CURLE_ CURL_NETRC_/) {
+ for my $group (qw/CURLOPT_ CURLINFO_ CURLE_ CURL_NETRC_ CURLPROXY_/) {
for my $option (sort keys %{$constants{$group}}) {
next unless $option;
print EASY_PM $group.$option."\n";
diff --git a/SIGNATURE b/SIGNATURE
index 54cfbb5..c5e2658 100644
--- a/SIGNATURE
+++ b/SIGNATURE
@@ -14,12 +14,12 @@ not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
-SHA1 758725823ca0719908b1138da03481c2ba8419d7 Changes
-SHA1 32ad177360c0e370e4c1bdb83ead474961769e96 Curl.xs
+SHA1 e5832a6de950df4208e57c3b5ce5978e867df5df Changes
+SHA1 cc58e04a4fb86d0ad8ef6abb882b515648ef4c9e Curl.xs
SHA1 94cbea5b3fb940e25cd4535d1c81bfd7d51dac3c LICENSE
SHA1 a33cdbb8996d5b8dfc92da6d34e7327ebde1b1c5 MANIFEST
-SHA1 122bbde2eee75a39914d2b64b8bcc1d9462385b3 META.yml
-SHA1 3025d3ee924e6e7a2f9b5249a646331502c9be72 Makefile.PL
+SHA1 6455def3635ae5d2c55e853a61f7c21acc6637d6 META.yml
+SHA1 bf0ea5c3c087f69376656276fffea8524b02323f Makefile.PL
SHA1 a21d7184f91692fb3d6d7175e4a526f9d99fe3c7 README
SHA1 ed6f9f399075307a33bd02902ebbadbbbfbd8bab README.Win32
SHA1 fd5f3c4f0418efee3b9b16cf8c3902e8374909df inc/Module/Install.pm
@@ -29,13 +29,13 @@ SHA1 a9d6306080cee9c32b18f6cbd3c7636ece67e81a inc/Module/Install/External.pm
SHA1 dbec1085a29a855202ee797a5bac319cf426827f inc/Module/Install/MakeMaker.pm
SHA1 3e83972921d54198d1246f7278f08664006cd65d inc/Module/Install/Makefile.pm
SHA1 12bf1867955480d47d5171a9e9c6a96fabe0b58f inc/Module/Install/Metadata.pm
-SHA1 7c063f5e01e0489f3725092ea2da3699d9b925d7 lib/WWW/Curl.pm
-SHA1 4e95036c5543aecf91e3d97fa79df03f4a367ffa lib/WWW/Curl/Easy.pm
-SHA1 3fc2f9b503827e28b96c4ea49034039b7f23ab20 lib/WWW/Curl/Form.pm
+SHA1 5d57332dcfd0ee1be67873be520d4371e7bf7262 lib/WWW/Curl.pm
+SHA1 6c3fd8228370ae898e4e0fefcc280aeea9c097fe lib/WWW/Curl/Easy.pm
+SHA1 7ff51363b45f28c4fabc5888c64515eb7f450ae6 lib/WWW/Curl/Form.pm
SHA1 0bddc700447a50dd26d13119ee60349556ce1811 lib/WWW/Curl/Multi.pm
SHA1 bcf4bc64399691f1871b9592ced73ce5fef86fea lib/WWW/Curl/Share.pm
SHA1 802cb1fcd35fe78e4cdb10164a05e54ce1427543 t/00constants.t
-SHA1 263f02465cc31d3233585dc7e387137edcf560f0 t/01basic.t
+SHA1 88c7780f18aab350318bd8c6d887558a4ce17519 t/01basic.t
SHA1 07b63b1baca142a0e34e79633d0eb57684524bed t/02callbacks.t
SHA1 905c848deb6492d539c5bdf89c49632a412af15a t/04abort-test.t
SHA1 f9c842503835908a0687ab41655042a16b8b5112 t/05progress.t
@@ -66,13 +66,13 @@ SHA1 eee30cfb57132e7c8bdd4a5dd2f32273ab222115 t/new/10multi-callback.t
SHA1 20ec0bd03ff2600505d38623153a6eb3087b5814 t/new/README
SHA1 ac25bfa56d36f19cbee72a968b06372e88602a61 t/pod-coverage.t
SHA1 0190346d7072d458c8a10a45c19f86db641dcc48 t/pod.t
-SHA1 1916f03aef4da23a6a998c855f7ef57781b79b51 template/Easy.pm.tmpl
+SHA1 6333c54cd70480a71e628e49c42551624f151f68 template/Easy.pm.tmpl
SHA1 b4841adcad866b70d9d72f171d3d0f8f9d5b3c79 template/Share.pm.tmpl
SHA1 468b011caaf4d54609b421027d7c6262a9260e89 typemap
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
-iF4EAREIAAYFAksrrC4ACgkQ9vEeIen/Zj4GswEAl8QU2W9k3rsyWMCP2Kfn0JXp
-Si/audyYpl6y592ug60A/1pLz1HUg29JBVunnnTbxbn51wNSz/xgzF6dOooHGL2C
-=bATu
+iF4EAREIAAYFAkwxBuEACgkQ9vEeIen/Zj5PcQEAhQQMhnYTxSPbAfJpQEzgkAKb
+OOmfT+ee84HR9sSr1akBAKE6L1eHzwf+WrrT2wLTHfTQfuP8OyYt6eM1Vw4Duvmj
+=T9bp
-----END PGP SIGNATURE-----
diff --git a/lib/WWW/Curl.pm b/lib/WWW/Curl.pm
index 054f79b..63c2fc9 100644
--- a/lib/WWW/Curl.pm
+++ b/lib/WWW/Curl.pm
@@ -6,7 +6,7 @@ use vars qw(@ISA $VERSION);
use DynaLoader;
BEGIN {
- $VERSION = '4.11';
+ $VERSION = '4.12';
@ISA = qw(DynaLoader);
__PACKAGE__->bootstrap;
}
@@ -169,6 +169,26 @@ This is how you enable sharing for a specific WWW::Curl::Easy handle:
$curl->setopt(CURLOPT_SHARE, $curlsh)
Attach share object to WWW::Curl::Easy instance
+=head1 WWW::Curl::Form
+
+ use WWW::Curl::Form;
+ my $curlf = WWW::Curl::Form->new;
+ $curlf->curl_formaddfile($filename, 'attachment', "multipart/form-data");
+ $curlf->curl_formadd("FIELDNAME", "VALUE");
+
+ $curl->setopt(CURLOPT_HTTPPOST, $curlf);
+
+Its usable methods are:
+
+ $curlf = new WWW::Curl::Form
+ This method constructs a new WWW::Curl::Form object.
+
+ $curlf->formadd(FIELDNAME, VALUE)
+ This method adds a field with a given value, to the form that is being submitted.
+
+ $curlf->formaddfile(FILENAME, DESCRIPTION, TYPE)
+ This method will add a file to the form. The description is the name of the field
+ that you form expects the data to be submitted in.
=head1 COMPATIBILITY
@@ -217,7 +237,11 @@ Not implemented and won't be as this method is considered deprecated.
=item curl_formadd
-Not yet implemented.
+Seems to be working.
+
+=item curl_formaddfile
+
+Seems to be working.
=item curl_formfree
@@ -340,7 +364,7 @@ repackaged the module into a more modern form.
=head1 COPYRIGHT
-Copyright (C) 2000-2005,2008,2009 Daniel Stenberg, Cris Bailiff,
+Copyright (C) 2000-2005,2008-2010 Daniel Stenberg, Cris Bailiff,
Sebastian Riedel, Balint Szilakszi et al.
You may opt to use, copy, modify, merge, publish, distribute and/or sell
diff --git a/lib/WWW/Curl/Easy.pm b/lib/WWW/Curl/Easy.pm
index 2f0829b..2b91f4c 100644
--- a/lib/WWW/Curl/Easy.pm
+++ b/lib/WWW/Curl/Easy.pm
@@ -5,7 +5,7 @@ use warnings;
use Carp;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
-$VERSION = '4.11';
+$VERSION = '4.12';
require WWW::Curl;
require Exporter;
@@ -23,6 +23,11 @@ require AutoLoader;
$WWW::Curl::Easy::headers = "";
$WWW::Curl::Easy::content = "";
+sub const_string {
+ my ($self, $constant) = @_;
+ return constant($constant,0);
+}
+
sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()
diff --git a/lib/WWW/Curl/Form.pm b/lib/WWW/Curl/Form.pm
index 7ea117f..a2022c7 100644
--- a/lib/WWW/Curl/Form.pm
+++ b/lib/WWW/Curl/Form.pm
@@ -1,13 +1,32 @@
package WWW::Curl::Form;
use strict;
use warnings;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
-# In development!
-#
-#require WWW::Curl;
-#use vars qw(@ISA @EXPORT_OK);
-#require Exporter;
-#require AutoLoader;
-# @ISA = qw(Exporter DynaLoader);
+$VERSION = '4.12';
+
+require WWW::Curl;
+require Exporter;
+require AutoLoader;
+
+@ISA = qw(Exporter DynaLoader);
+
+@EXPORT = qw(
+CURLFORM_FILE
+CURLFORM_COPYNAME
+CURLFORM_CONTENTTYPE
+);
+
+sub AUTOLOAD {
+
+ # This AUTOLOAD is used to 'autoload' constants from the constant()
+ # XS function.
+
+ ( my $constname = $AUTOLOAD ) =~ s/.*:://;
+ return constant( $constname, 0 );
+}
1;
+
+__END__
+
diff --git a/t/01basic.t b/t/01basic.t
index 58fdf4d..887aa00 100644
--- a/t/01basic.t
+++ b/t/01basic.t
@@ -49,7 +49,9 @@ ok( $httpcode, "getinfo returns CURLINFO_HTTP_CODE");
SKIP: {
skip "Only testing cookies against google.com", 2 unless $url eq "http://www.google.com";
- my $cookies = $curl->getinfo(CURLINFO_COOKIELIST);
+ my $cookielist_const = $curl->const_string("CURLINFO_COOKIELIST");
+ skip "libcurl doesn't have the CURLINFO_COOKIELIST constant", 2 unless $cookielist_const;
+ my $cookies = $curl->getinfo($cookielist_const);
is(ref $cookies, "ARRAY", "Returned array reference");
ok(@$cookies > 0, "Got 1 or more cookies");
}
diff --git a/template/Easy.pm.tmpl b/template/Easy.pm.tmpl
index c29dea5..f150277 100644
--- a/template/Easy.pm.tmpl
+++ b/template/Easy.pm.tmpl
@@ -5,7 +5,7 @@ use warnings;
use Carp;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK $AUTOLOAD);
-$VERSION = '4.11';
+$VERSION = '4.12';
require WWW::Curl;
require Exporter;
@@ -24,6 +24,11 @@ require AutoLoader;
$WWW::Curl::Easy::headers = "";
$WWW::Curl::Easy::content = "";
+sub const_string {
+ my ($self, $constant) = @_;
+ return constant($constant,0);
+}
+
sub AUTOLOAD {
# This AUTOLOAD is used to 'autoload' constants from the constant()