Created
January 22, 2011 15:32
-
-
Save f99aq8ove/791181 to your computer and use it in GitHub Desktop.
parse JSON only
This file contains 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
--- a/Stream.pm 2011-01-23 00:27:05.243140965 +0900 | |
+++ b/Stream.pm 2011-01-23 00:28:17.402025511 +0900 | |
@@ -154,7 +154,7 @@ | |
my($handle, $json) = @_; | |
# Twitter stream returns "\x0a\x0d\x0a" if there's no matched tweets in ~30s. | |
$set_timeout->(); | |
- if ($json) { | |
+ if ($json && $json =~ /^{/) { | |
my $tweet = $decode_json ? JSON::decode_json($json) : $json; | |
if ($on_delete && $tweet->{delete} && $tweet->{delete}->{status}) { | |
$on_delete->($tweet->{delete}->{status}->{id}, $tweet->{delete}->{status}->{user_id}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment