* delete old style client
authormitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Sat, 11 Sep 2010 03:49:29 +0000 (03:49 +0000)
committermitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Sat, 11 Sep 2010 03:49:29 +0000 (03:49 +0000)
 * read configuration from YAML format file

git-svn-id: https://lab.mitty.jp/svn/lab/trunk/twitter@46 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

get_oauth.pl
nt_bot.pl
twitbot.pl [deleted file]

index 6f840ab..505d228 100755 (executable)
@@ -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'],
index 3fec52e..623560b 100755 (executable)
--- 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 (executable)
index b53c6dc..0000000
+++ /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 を更新するテストですよー');