Agent
view release on metacpan or search on metacpan
=over 4
=item store()
Returns the agent object in stringified form, suitable for network
transfer or storage.
=item run()
Executes the agent. If the I<Thread> argument is passed and your system has
Thread.pm, run() tries to execute the agent in an asynchronous thread via
Thread's async() command (see the Thread pod for more details). Additional
arguments are passed to the agent being run.
=item identity()
Returns a unique string identifying the agent I<in its present state>.
=back
=head1 SEE ALSO
examples/Static.pa view on Meta::CPAN
sub host_agent {
my $self = shift;
my $stored = join('', @_);
my (%args, $agent, $str);
$args{Stored} = $stored;
$args{Thread} = 1 if $self->{Thread};
$str .= ($self->{Thread})
? "Trying to execute agent asynchronously."
: "Executing agent.";
if ($self->{Cpt}) {
$str .= " Using a Safe compartment.";
$args{Compartment} = new Safe();
}
print "$str\n" if $self->{verbose};
$agent = new Agent(%args) or return;
examples/Static.pa view on Meta::CPAN
static agent a message containing its store()'d self, which the static agent
then unpacks and executes.
=head1 PARAMETERS
The following arguments may be passed when creating a new static agent:
Address => address to [attempt to] register
Medium => address medium
Cpt => use Safe compartments?
Thread => attempt to run agents in asynchronous threads
verbose => verbose
All arguments are optional. The static agent will try to register
TCP / 127.0.0.1:24368 if no medium/address is passed.
=head2
=head1 NOTES
A static agent will accept messages of the form:
( run in 0.282 second using v1.01-cache-2.11-cpan-0d8aa00de5b )