I'm interfacing with a payment gateway and not having any luck with Net::SSLeay and its post_https subroutine. The payment gateway has issued me a client certificate that must be used for authentication. The Net::SSLeay perldoc has the following example:

($page, $response, %reply_headers)
         = post_https('', 443, '/foo.cgi',           # 3b
              make_headers('Authorization' =>
                           'Basic ' . MIME::Base64::encode("$user:$pass",'')),
              make_form(OK   => '1', name => 'Sampo'),
              $mime_type6, $path_to_crt7, $path_to_key8);

My own version is below and returns the error Too many arguments for Net::SSLeay::post_https:


use strict;
use warnings;
use Net::SSLeay qw(post_https);

my %post = (

my ($page, $response, %reply_headers) = post_https(

Why is this error occurring?

Was it helpful?


New versions of Net::SSLeay don't have the prototype that old versions have. Reading the source of old and new version I'd say the prototype was a bug (the code it calls can handle more variables than advertised).

The solution I recommend is upgrading to a newer version of Net::SSLeay. If that is not possible, calling it like &post_https can be a quick but ugly fix.


The documentation is incorrect. In my copy (Net::SSLeay 1.04) post_https is shown in the documentation with the example that you cite, but is declared to take a maximum of 6 arguments:

sub post_https ($$$;***) { do_httpx2(POST => 1, @_) }

I'm not yet sure how to make it work.

Edit: Try calling post_https the old fashioned way, as a subroutine using &post_https(...).

You have an extra comma after '/path/to/key'

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow