Agent

 view release on metacpan or  search on metacpan

INSTALL  view on Meta::CPAN


	perl Makefile.PL
	make
	make install


Apply the Patch
---------------

Included with this distribution is a patch for Tom.pm v2.04 AlphaThree.  To
apply the patch go to Class-Tom-2.04's parent directory, and type:

	patch -p0 < Tom.pm.patch-spurkis-a3-01

Or just apply the patch manually - it's a simple two line fix.


Note for Win32 Users
--------------------

If you don't have a make utility, try setting your PERL5LIB environment

Thread.readme  view on Meta::CPAN

Thread Suppport
---------------
Agent threads are still considered alpha at the moment.  So far, they have
worked for me, but I haven't done anything complicated with them yet. :)

I would _like_ to make sending and recieving messages near-transparent by,
for example, having a queue of incoming/outgoing messages, assigning one
thread to handle all incoming data and another to handle all outgoing.

And I've got some other ideas too, but they are all just dreams at the
moment.

--Steve Purkis
October 5, 1998

examples/keepalive.pl  view on Meta::CPAN

my $tcp = new Agent::Transport(
	Medium => 'TCP',
	Cycle => 1,
	Address => '127.0.0.1:24368'
) or die "Couldn't get a tcp transport address: $!!\n";
$addr = $tcp->address();
print "Got tcp address $addr.\n";

unless ($pid=fork()) {
	# child
	print "forked. parent is $$.\n";
	my $serv;
	sleep 1;	# give time for server to setup...
        my $con = new IO::Socket::INET(
                Proto => 'tcp',
                Timeout => 10,
                PeerAddr => $addr,
                Reuse => 1
        ) or die "C: Ack! $!";
	$con->autoflush();

	print "C: made it! ", ref( $con ), "\n";
	print $con "Hello There!\n";
	print "C: ", <$con>, "finished printing, exiting.\n";;
	exit 0;
}
# parent

print "forked.  child is $pid.\n";
print "S: waiting for incoming...\n";
my $client = $tcp->accept() or die "ACK!";

my @data = $client->getline;

print "S: made it! ", ref( $client ), "\n";
print @data;
print "S: writing 'hi there!\\n' to C...\n";



( run in 0.240 second using v1.01-cache-2.11-cpan-4d50c553e7e )