#!/usr/bin/perl
use warnings;
use strict;
use AnyEvent::Redis;
use Data::Dump qw(dump);

my $sub = AnyEvent::Redis->new( host => $ENV{REDIS_HOST}, port => $ENV{REDIS_PORT} );

my $track;

my $sub_cv = $sub->psubscribe('*', sub {
	my($message, $chan) = @_;
	warn "$chan | $message\n";
	if ( $message =~ m/^!track\s*(.+)/ ) {
		$track->{$chan}->{$1}++;
		warn "# track ",dump($track);
	}
});

AnyEvent->condvar->recv;

