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'],
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'],
$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 を更新するテストですよー" });
+++ /dev/null
-#!/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 を更新するテストですよー');