Agent - the Transportable Agent Perl module
use Agent; my $a = new Agent( Name => 'path_to_agent.pa', %args ); $a->run();
Agent Perl is meant to be a multi-platform interface for writing and using transportable perl agents.
Is any chunk of Perl code that can accomplish some user-defined objective by communicating with other agents, and manipulating any data it obtains.
A Perl Agent consists of a knowledge base (variables), a reasoning procedure (code), and access to one or more languages coupled with methods of communication. These languages remain largely undefined, or rather, user-defined; support for KQML/KIF is under development.
Note that the developer must devise the reasoning procedure and knowledge base described above. Agent Perl does not place any restrictions on what you may do; it only tries to make the 'doing' part easier.
An agent is written as an inheriting sub-class of Agent. Each agent's class should be stored in a '.pa' file (perl agent), and must contain an
agent_main() method. All agents are objects. See the examples for more details, and learn how Agent.pm works so you won't step on its toes!
Arguments to subroutines are passed in hashes unless otherwise noted.
Capital-a Agent refers to
Agent.pm unless the context is obvious. Lowercase agent refers to an agent.
Creates a new agent object. You must tell new() where to get the agent by passing in one of the following arguments (in a hash):
Stored: The agent stored in a Tom object.
File: An IO::Handle (or any subclass) file handle from which the agent can be read.
Name: The agent's name. This prompts new to search @INC and './' for the agent's '.pa' source file.
Code: The agent's source code.
These are listed in order of precedence. To handle security issues, new() also groks this argument:
Compartment: A Safe Compartment within which the agent will be registered, and later executed. See the
Safe pod for details.
Developers should note that these keywords are reserved. Any additional arguments are passed to the agent being created.
Returns the agent object in stringified form, suitable for network transfer or storage.
Executes the agent. If the 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.
Returns a unique string identifying the agent in its present state.
Steve Purkis <firstname.lastname@example.org>
Copyright (c) 1997, 1998 Steve Purkis. All rights reserved. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
James Duncan for the
Tom module and many ideas; the people of the Perl5-Agents mailing list for their support.