Agent

 view release on metacpan or  search on metacpan

examples/dcalc.pl  view on Meta::CPAN


# if you want to see lots of meaningless output :-), uncomment these:
#$Agent::Transport::TCP::Debug = 1;
#$Agent::Debug = 1;
#$Class::Tom::debug = 2;

# first, set up the arguments:
my (%args, %hosts);
while (my $arg = shift @ARGV) {
	if ($arg =~ /.+\:\d+/) {
		# safe to say it's an ip address
		if ($args{Return}) { $hosts{$arg} = ''; }
		else               { $args{Return} = $arg; }
	} elsif ($arg =~ /-v/i) {
		$args{'verbose'} = 1;
	} elsif ($arg =~ /-t/i) {
		$args{'Thread'} = 1;
	}
}
unless ((keys(%hosts)) > 0) { print $usage; exit 1; }
print "starting distributed calculation agent system.\n";

examples/ex.pl  view on Meta::CPAN

# if you want to see lots of meaningless output :-), uncomment these:
$Agent::Message::Debug = 1;
$Agent::Transport::TCP::Debug = 1;
$Agent::Debug = 1;
#$Class::Tom::debug = 1;

# first, set up the arguments (maybe I should use GetOpt???):
my (%args, $logfile);
while ($arg = shift @ARGV) {
	if ($arg =~ /.+\:\d+/) {
		# safe to say it's an ip address
		push (@{$args{'Hosts'}}, $arg);
		# but HelloWorld agents can only handle 1 Host:
		$args{'Address'} = $arg;
		if (exists($args{'Host'})) {
			$args{'Return'} = $arg;
		} else {
			$args{'Host'} = $arg;
		}
		# and Loop agents like 'Tell' better...
		$args{'Tell'} = $arg;



( run in 1.419 second using v1.01-cache-2.11-cpan-483215c6ad5 )