title: Post several Pictures on tumblr via api with Perl
body: <p>I'm trying to post 3 pictures in tumblr via perl API ...</p>
  
  <p>I have this code work good with one picture :</p>
  
  <pre><code>use LWP::Authen::OAuth;
  use Data::Dumper;
  
  my $ua = LWP::Authen::OAuth-&gt;new(
              oauth_consumer_key =&gt; 'xxx',
              oauth_consumer_secret =&gt; 'xxx',
              oauth_token =&gt; 'xxx',
              oauth_token_secret =&gt; 'xxx',
      );
  my $url  = 'http://publicpics.free.fr/856833_10151249956981150_1285625380_o.jpg';
  my %elements = (  
    'type' =&gt; 'photo', 
    'source' =&gt;  $url,
  );
  
  print Dumper (\%elements);
  print $ua-&gt;post( 'http://api.tumblr.com/v2/blog/xxxx.tumblr.com/post', [%elements] )-&gt;as_string;
  </code></pre>
  
  <p>I use this API Documentation <a href="http://www.tumblr.com/docs/en/api/v2#posting" rel="nofollow">http://www.tumblr.com/docs/en/api/v2#posting</a></p>
  
  <p>For several pictures you must past in parameters an Array ... So i Try this but dont' work :</p>
  
  <pre><code>use LWP::Authen::OAuth;
  use Data::Dumper;
  
  my $ua = LWP::Authen::OAuth-&gt;new(
              oauth_consumer_key =&gt; 'xxx',
              oauth_consumer_secret =&gt; 'xxx',
              oauth_token =&gt; 'xxx',
              oauth_token_secret =&gt; 'xxx',
      );
  my @url  = ( 'http://publicpics.free.fr/856833_10151249956981150_1285625380_o.jpg' );
  my %elements = (  
    'type' =&gt; 'photo', 
    'data' =&gt;  \@url,
  );
  
  print Dumper (\%elements);
  print $ua-&gt;post( 'http://api.tumblr.com/v2/blog/xxxx.tumblr.com/post', [%elements] )-&gt;as_string;
  </code></pre>
  
  <p><strong>I have this return :</strong> </p>
  
  <pre><code>$VAR1 = {
        'data' =&gt; [
                    'http://publicpics.free.fr/856833_10151249956981150_1285625380_o.jpg'
                  ],
        'type' =&gt; 'photo'
      };
  HTTP/1.1 400 Bad Request
  Connection: close
  Date: Sun, 03 Mar 2013 22:01:13 GMT
  Server: Apache
  Vary: Accept-Encoding
  Content-Length: 92
  Content-Type: application/json
  Client-Date: Sun, 03 Mar 2013 22:01:13 GMT
  Client-Peer: 66.6.36.55:80
  Client-Response-Num: 1
  P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
  X-Tumblr-Usec: D=112074
  
  {"meta":{"status":400,"msg":"Bad Request"},"response":{"errors":["Error uploading photo."]}}
  </code></pre>