X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FGruntmaster%2FData.pm;h=9504cf849b7220c6e658fc16c33a283cc5f2fd57;hb=0a15a1ec7c775be1565ff9e6e83e42e049fa1bcb;hp=9f4cf952b1d7ebc64f6759e2708bb5198a185661;hpb=e5f2bda6c8984be0c49a3e058a165286791fef51;p=plack-app-gruntmaster.git diff --git a/lib/Gruntmaster/Data.pm b/lib/Gruntmaster/Data.pm index 9f4cf95..9504cf8 100644 --- a/lib/Gruntmaster/Data.pm +++ b/lib/Gruntmaster/Data.pm @@ -9,6 +9,7 @@ use Redis; our $contest; my $redis = Redis->new; +my $pubsub = Redis->new; sub dynsub{ no strict 'refs'; @@ -19,6 +20,10 @@ BEGIN { for my $cmd (qw/multi exec smembers get hget hset sadd srem incr hmset hsetnx/) { dynsub uc $cmd, sub { say "Arguments to \U$cmd: ", join ', ', @_; $redis->$cmd(@_) }; } + + for my $cmd (qw/publish subscribe wait_for_messages/) { + dynsub uc $cmd, sub { say "Arguments to \U$cmd: ", join ', ', @_; $pubsub->$cmd(@_) }; + } } sub cp { defined $contest ? "contest.$contest." : '' } @@ -66,6 +71,7 @@ sub defhash{ defhash problem => qw/name level statement/; defhash contest => qw/start end name owner/; defhash job => qw/date extension filesize private problem result result_text user/; +defhash user => qw/name email town university/; our @EXPORT_OK = do { no strict 'refs';