Hello,

I hope someone can help as i've been stuck on this for a while now. The
below code errors with the following : Not a SCALAR reference at
/usr/lib/perl5/site_perl/5.8.
8/HTTP/Message.pm line 156.

I know that this is because @form_data is an array, not a scalar, but I
can't seem to get the right syntax to convert it to a scalar.

Any help would be greatfully recieved.

Regards,

Paul

#!/usr/bin/perl

use strict;
use LWP::UserAgent;
use HTTP::Cookies;
use HTTP::Request::Common;
use warnings;

our $COOKIE_JAR_DIR="/root/cookie_jar";
our $COOKIE_FILE="$COOKIE_JAR_DIR/cookies.txt";

my $url = "https://my.rightscale.com/api/acct/xxxx/servers/yyyyy";;

my @headers = ('X-API-VERSION' => "1.0");
my @form_data;
push @form_data, 'server[parameters][DNSMADEEASY_DNSIDS]' => 'text:1234';

my $ua = LWP::UserAgent->new;
my $response = $ua->request(PUT $url, @headers, Content => \...@form_data);

if (!$response->is_success) {
  print $response->decoded_content;  # or whatever
  die $response->status_line;
}

print $response->decoded_content;

Reply via email to