+sub https_post {
+ # simplify this a little
+ my ($self, $path, $args) = @_;
+ warn "Sending to $path\n" if $self->debug;
+ $args ||= {};
+ warn Dumper($args)."\n\n" if $self->debug >= 2;
+ $args = {
+ content => $self->serialize($args),
+ login => $self->login,
+ password => $self->password
+ };
+ my ($page, $response, %reply_headers) = Net::HTTPS::Any::https_post(
+ host => $self->host,
+ port => $self->port,
+ path => $path,
+ args => $args,
+ debug => 0,
+ );
+ die "Bad response from server: $response\n" if $response !~ /^200/;
+ warn "$response\n" if $self->debug;
+ my ($result, $error);
+ try {
+ $result = $self->deserialize($page);
+ } catch {
+ # Storable error messages are useless.
+ $error = "Bad data from server:\n$page\n";
+ };
+ warn Dumper($result)."\n\n" if $self->debug >= 2;
+ $error ||= $result->{error} if ref $result eq 'HASH';
+ die "$error\n" if $error;
+
+ $result;
+};
+