From: mitty Date: Sat, 11 Sep 2010 03:49:29 +0000 (+0000) Subject: * delete old style client X-Git-Url: http://lab.mitty.jp/git/?p=lab.git;a=commitdiff_plain;h=287b49c4c00ca9912cc78e2fd2f0cb98f5e6f292 * delete old style client * read configuration from YAML format file git-svn-id: https://lab.mitty.jp/svn/lab/trunk/twitter@46 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- diff --git a/get_oauth.pl b/get_oauth.pl index 6f840ab..505d228 100755 --- a/get_oauth.pl +++ b/get_oauth.pl @@ -4,8 +4,13 @@ use warnings; use utf8; use Net::Twitter; -my $consumer_key = 'CONSUMER_KEY'; -my $consumer_key_secret = 'CONSUMER_KEY_SECRET'; +use YAML::Tiny; +my $config = (YAML::Tiny->read('config.yml'))->[0]; + +my $consumer_key = $config->{'consumer_key'}; +my $consumer_key_secret = $config->{'consumer_key_secret'}; +my $access_token = $config->{'access_token'}; +my $access_token_secret = $config->{'access_token_secret'}; my $nt = Net::Twitter->new( traits => ['API::REST', 'OAuth'], diff --git a/nt_bot.pl b/nt_bot.pl index 3fec52e..623560b 100755 --- a/nt_bot.pl +++ b/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_key_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 を更新するテストですよー" }); diff --git a/twitbot.pl b/twitbot.pl deleted file mode 100755 index b53c6dc..0000000 --- a/twitbot.pl +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; -use YAML::Tiny; -use Net::Twitter; - -my $config = (YAML::Tiny->read('config.yml'))->[0]; -my $twit = Net::Twitter->new(username => $config->{'username'}, password => $config->{'password'}); - -$twit->update('Perl から Twiitter を更新するテストですよー');