WWW::Tumblr - Perl bindings for the Tumblr API
5.00
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;
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():
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.
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.
Please refer to each module for further tips, tricks and slightly more detailed documentation:
WWW::Tumblr::Blog
WWW::Tumblr::User
WWW::Tumblr::Tagged
WWW::Tumblr::ResponseError
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.
t/
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.
examples/
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.
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.
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.
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.
Net::OAuth because, you know, we're based off it.
Moose, likewise.
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.
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/.
To install WWW::Tumblr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Tumblr
CPAN shell
perl -MCPAN -e shell install WWW::Tumblr
For more information on module installation, please visit the detailed CPAN module installation guide.