Net::Tumblr
http://fuba.tumblr.com/post/2327086
ããããä»æ§ãªãä½ãã¾ã§ããªãæ°ããããã©ç»åBotã®ããã«ä½ã£ã¦ã¿ããã©ä¸ç¬ã§å®¹éå¶é溢ããã®ã§åå¨æ義ããªããªã£ã¦ã¨ããããæ¾åºãã³ã¼ãã¯ãã£ã±ãã¯ã¦ãã®æ¹ããããªâ¦ã
usage.pl
use Net::Tumblr; my $url = shift; my $t = Net::Tumblr->new( email => '[email protected]', password => 'password' )->write( type => 'photo', source => $url, caption => "<a href=\"$url\">$url</a>", );
詳ããã¯Tumblr - APIåç §ã
Net/Tumblr.pm
package Net::Tumblr; use strict; use warnings; use LWP::UserAgent; use URI::Escape qw/uri_escape_utf8/; use constant API_WRITE => 'http://www.tumblr.com/api/write'; sub new { my $pkg = shift; my %opt = @_; my $ua = LWP::UserAgent->new(); bless { email => ($opt{email} or die 'no email'), password => ($opt{password} or die 'no password'), generator => ($opt{generator} or 'Net::Tumblr'), ua => $ua, }, $pkg; } sub write { my $self = shift; my %opt = @_; $opt{email} = $self->{email}; $opt{password} = $self->{password}; $opt{generator} = $self->{generator}; my $req = HTTP::Request->new(POST => &API_WRITE); $req->content_type('application/x-www-form-urlencoded'); my $param = join '&', map {"$_=".uri_escape_utf8($opt{$_})} grep {$opt{$_}} keys %opt; $req->content($param); return $self->{ua}->request($req); } 1;