Skip to content

Instantly share code, notes, and snippets.

@riywo
Created October 29, 2012 15:45
Show Gist options
  • Save riywo/3974277 to your computer and use it in GitHub Desktop.
Save riywo/3974277 to your computer and use it in GitHub Desktop.
use strict;
use warnings;
use AnyEvent::Twitter::Stream;
use LWP::UserAgent;
my $config = {
consumer_key => $ENV{CONSUMER_KEY},
consumer_secret => $ENV{CONSUMER_SECRET},
token => $ENV{TOKEN},
token_secret => $ENV{TOKEN_SECRET},
};
my $cv = AE::cv;
my $tw = AnyEvent::Twitter::Stream->new(
%$config,
method => 'userstream',
on_tweet => sub {
my ($tweet) = @_;
my $ua = LWP::UserAgent->new;
$ua->post($ENV{GFAAS_URL}.'/api/example/twitter/riywo_TL_num', {
number => 1,
mode => 'count',
});
},
);
$cv->recv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment