Skip to content

Instantly share code, notes, and snippets.

@turugina
Created February 10, 2011 07:29
Show Gist options
  • Save turugina/820095 to your computer and use it in GitHub Desktop.
Save turugina/820095 to your computer and use it in GitHub Desktop.
diff --git a/lib/AnyEvent/Twitter/Stream.pm b/lib/AnyEvent/Twitter/Stream.pm
index 34f4539..4ba412c 100644
--- a/lib/AnyEvent/Twitter/Stream.pm
+++ b/lib/AnyEvent/Twitter/Stream.pm
@@ -154,7 +154,7 @@ sub new {
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