#!/usr/bin/perl use strict; use Net::Knuddels; use IO::Socket; use IO::Handle; use IO::Socket::INET; sub new_socks { my ($host, $port) = @_; my $s = IO::Socket::INET->new ( PeerAddr => $host, PeerPort => $port, Proto => 'tcp' ); die "Couldn't make socket to ${host}:${port}: $!\n"; } my $knudi = Net::Knuddels::Protocol->new (); my %channels; $knudi->register ('b' => sub { for (@_) { if ($_ ne "-") { } else { } } }); my $sock = new_socks ($ARGV[0], $ARGV[1]); my $clw = Event->io ( fd => $sock, poll => 'r', cb => sub { my $data; $sock->sysread ($data, 1000); $knudi->feed_data ($data); });