The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WWW::Tumblr - Perl bindings for the Tumblr API

VERSION

5.00

SYNOPSIS

  my $t = WWW::Tumblr->new(
     consumer_key    => $consumer_key,
     secret_key      => $secret_key,
     token           => $token,
     token_secret    => $token_secret,
  );
 
  my $blog = $t->blog('perlapi.tumblr.com');

  print Dumper $blog->info;

DESCRIPTION

This module makes use of some sort of the same models as the upstream API, meaning that you will have User, Blog and Tagged methods:

  my $t = WWW::Tumblr->new(
    consumer_key    => $consumer_key,
    secret_key      => $secret_key,
    token           => $token,
    token_secret    => $token_secret,
  );

  # Once you have a WWW::Tumblr object, you can get a WWW::Tumblr::Blog object
  # by calling the blog() method from the former object:
  
  my $blog = $t->blog('perlapi.tumblr.com');
 
  # And then just use WWW::Tumblr::Blog methods from it:
  if ( my $post = $blog->post( type => 'text', body => 'Hell yeah, son!' ) ) {
     say "I have published post id: " . $post->{id};    
  } else {
     print STDERR Dumper $blog->error;
     die "I couldn't post it :(";
  }

You can also work directly with a WWW::Tumblr::Blog class for example:

  # You will need to set base_hostname:
  my $blog = WWW::Tumblr::Blog->new(
     %four_tokens,
     base_hostname => 'myblogontumblr.com'
  );

All operation methods on the entire API will return false in case of an upstream error and you can check the status with error():

  die Dumper $blog->error unless $blog->info();

On success, methods will return a hash reference with the JSON representation of the upstream response. This behavior has not changed from previous versions of this module.

METHOD PARAMETERS

All methods require the same parameters as the upstream API, passed as hash where the keys are the request parameters and the values the corresponding data.

DOCUMENTATION

Please refer to each module for further tips, tricks and slightly more detailed documentation:

Take also a look at the t/ directory inside the distribution. There you can see how you can do a bunch of things: get posts, submissions, post quotes, text, etc, etc.

AUTHORIZATION

It is possible to generate authorization URLs and do the whole OAuth dance. Please refer to the examples/ directory within the distribution to learn more.

CAVEATS

This is considered an experimental version of the module. The request engine needs a complete rewrite, as well as proper documentation. The main author of the module wanted to release it like this to have people interested on Tumblr and Perl give it a spin.

BUGS

Please report as many as you want/can. File them up at GitHub: https://github.com/damog/www-tumblr/issues/new. Please don't use the CPAN RT.

MODULE AND TUMBLR API VERSION NOTE

This module supports Tumblr API v2, starting from module version 5. Since the previous API was deprecated upstream anyway, there's no backwards compatibility with < 5 versions.

AUTHOR(S)

David Moreno is the main author and maintainer of this module. The following amazing people have also contributed from version 5 onwards: Artem Krivopolenov, Squeeks, Fernando Vezzosi.

SEE ALSO

COPYRIGHT and LICENSE

This software is copyright (c) 2013 by David Moreno.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER

The author is in no way affiliated to Tumblr or Yahoo! Inc. If either of them want to show their appreciation for this work, they can contact the author directly or donate a few of those billion dollars Yahoo! paid for Tumblr, to the Perl Foundation at http://donate.perlfoundation.org/.