Skip to content

Instantly share code, notes, and snippets.

@semifor
Created September 6, 2010 19:06
Show Gist options
  • Select an option

  • Save semifor/567381 to your computer and use it in GitHub Desktop.

Select an option

Save semifor/567381 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use warnings;
use strict;
use Net::Twitter;
use utf8;
use Net::Netrc;
my ($key, $key_secret) = Net::Netrc->lookup('semifor_test-scripts.oauth.twitter')->lpa;
my ($token, $token_secret) = Net::Netrc->lookup('semifor_test.semifor_test-scripts.oauth.twitter')->lpa;
# Tweet the currently playing song (because I was bored)
my $twitter = Net::Twitter->new(
traits => ['API::REST','OAuth'],
consumer_key => $key,
consumer_secret => $key_secret,
access_token => $token,
access_token_secret => $token_secret,
);
#$np = ' おはようございます'; # works
my $np = 'おはようございます'; # garbage
if (length($np) > 0) {
print("status text: ");
print($np);
print("\nis utf8: ");
print(utf8::is_utf8($np)); # will print 1
print("\n");
my $result = $twitter->update($np);
print("done\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment