projects
/
perl-Redis.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
simple publish script for testing
[perl-Redis.git]
/
scripts
/
publish.pl
1
#!/usr/bin/perl
2
use warnings;
3
use strict;
4
5
use Redis;
6
7
my $pub = Redis->new();
8
9
my $channel = $ARGV[0] || die "usage: $0 channel\n";
10
11
print "#$channel > ";
12
while(<STDIN>) {
13
chomp;
14
$channel = $1 if s/\s*\#(\w+)\s*//; # remove channel from message
15
my $nr = $pub->publish( $channel, $_ );
16
print "#$channel $nr> ";
17
}
18