Created
September 6, 2010 19:06
-
-
Save semifor/567381 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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