X-Git-Url: http://lab.mitty.jp/git/?a=blobdiff_plain;f=twitter%2Fnt_bot.pl;h=5b005caac1da91e18981d851b73515b7a69634b6;hb=d006afb818eeb5978aef6c84ec63104f86b087fe;hp=3fec52ebd108e09cc3518e8feec9ec49e8440290;hpb=c78c702bb1c017f8c37d5b6e1068e65934244b65;p=lab.git diff --git a/twitter/nt_bot.pl b/twitter/nt_bot.pl index 3fec52e..5b005ca 100755 --- a/twitter/nt_bot.pl +++ b/twitter/nt_bot.pl @@ -4,10 +4,13 @@ use warnings; use utf8; use Net::Twitter; -my $consumer_key = 'CONSUMER_KEY'; -my $consumer_key_secret = 'CONSUMER_KEY_SECRET'; -my $access_token = 'ACCESS_TOKEN'; -my $access_token_secret = 'ACCESS_TOKEN_SECRET'; +use YAML::Tiny; +my $config = (YAML::Tiny->read('config.yml'))->[0]; + +my $consumer_key = $config->{'consumer_key'}; +my $consumer_key_secret = $config->{'consumer_secret'}; +my $access_token = $config->{'access_token'}; +my $access_token_secret = $config->{'access_token_secret'}; my $nt = Net::Twitter->new( traits => ['API::REST', 'OAuth'], @@ -17,4 +20,4 @@ my $nt = Net::Twitter->new( $nt->access_token($access_token); $nt->access_token_secret($access_token_secret); -my $res = $nt->update({ status => "test tweet!" }); +my $res = $nt->update({ status => "Perl から Twiitter を更新するテストですよー" });