tokuhirom (owner)

Forks

Revisions

gist: 192339 Download_button fork
public
Public Clone URL: git://gist.github.com/192339.git
Embed All Files: show embed
poe-bug.pl #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use warnings;
use strict;
use POE;
use POE::Component::Server::TCP;
use Test::TCP;
use Test::More 0.94;
 
test_tcp(
    client => sub {
        my $port = shift;
        my $sock = IO::Socket::INET->new(
            PeerAddr => 'localhost',
            PeerPort => $port,
        ) or die $!;
        print $sock "hello\n";
        my $res = <$sock>;
        is unpack('H*', $res), unpack('H*', "hello\n");
        done_testing;
    },
    server => sub {
        my $port = shift;
 
        POE::Component::Server::TCP->new(
            Port => $port,
            ClientInput => sub { $_[HEAP]->{client}->put($_[ARG0]); },
        );
 
        POE::Kernel->run;
    },
);
 
result #
1
2
3
4
5
6
7
not ok 1
# Failed test at /home/tokuhirom/share/cpan/lib/perl5/Test/Builder.pm line 1069.
# got: '68656c6c6f0d0a'
# expected: '68656c6c6f0a'
1..1
# Looks like you failed 1 test of 1.