From: mitty Date: Sat, 11 Sep 2010 03:49:29 +0000 (+0000) Subject: * delete old style client X-Git-Tag: r89-trunk~38 X-Git-Url: http://lab.mitty.jp/git/?a=commitdiff_plain;h=1680a86dbcb5e3096eb1dc0a03da0d637131aa5b;p=lab.git * delete old style client * read configuration from YAML format file git-svn-id: https://lab.mitty.jp/svn/lab/trunk@46 7d2118f6-f56c-43e7-95a2-4bb3031d96e7 --- diff --git a/twitter/get_oauth.pl b/twitter/get_oauth.pl index 6f840ab..505d228 100755 --- a/twitter/get_oauth.pl +++ b/twitter/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/twitter/nt_bot.pl b/twitter/nt_bot.pl index 3fec52e..623560b 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_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/twitter/twitbot.pl b/twitter/twitbot.pl deleted file mode 100755 index b53c6dc..0000000 --- a/twitter/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 を更新するテストですよー');