W
Size: a a a
W
М
М
b
c
a
b
М
c
c
c
М
МС
М
package AsyncTargeter::Server;выводит
use strict;
use warnings;
use base qw(Net::Server::PreFork);
sub process_request {
my $self = shift;
while (<STDIN>) {
chomp;
print "Hello!\n";
}
}
клиент
my $id = Mojo::IOLoop->client({port => 20204} => sub {
my ($loop, $err, $stream) = @_;
$stream->on(read => sub {
my($stream, $bytes) = @_;
# Process input
say "Input: $bytes";
$loop->stop;
});
# Write request
$stream->write("GET / HTTP/1.1\x0d\x0a\x0d\x0a");
});
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
М
YK
М
М
W