Re: problems using PUT

[email protected] Mon, 8 Nov 2010 09:03:37 -0800
Newsgroups perl.libwww
Message-ID <[email protected]>
The page

http://search.cpan.org/~gaas/libwww-perl/lib/HTTP/Request/Common.pm

implies that a "form" array or hash reference is only accepted by  
POST, not PUT.

Best Regards,
cmac


On Nov 8, 2010, at 6:48 AM, Kevin Philp wrote:

> Should your response line be
>
> my $response = $ua->request(PUT $url, @headers, Content =>  
> @form_data);
>
>
> -----Original Message-----
> From: Paul Miles <[email protected]>
> To: [email protected]
> Subject: problems using PUT
> Date: Mon, 8 Nov 2010 14:29:28 +0000
>
>
> #!/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;