Steve Purkis > Agent > Agent

Download:
Agent-3.20.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: .   Source  

NAME ^

Agent - the Transportable Agent Perl module

SYNOPSIS ^

  use Agent;

  my $a = new Agent( Name => 'path_to_agent.pa', %args );

  $a->run();

DESCRIPTION ^

Agent Perl is meant to be a multi-platform interface for writing and using transportable perl agents.

A Perl Agent

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.

Developing An Agent

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!

CONVENTIONS ^

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.

CONSTRUCTOR ^

new()

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.

METHODS ^

store()

Returns the agent object in stringified form, suitable for network transfer or storage.

run()

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.

identity()

Returns a unique string identifying the agent in its present state.

SEE ALSO ^

Agent::Message and Agent::Transport for agent developers.

AUTHOR ^

Steve Purkis <spurkis@engsoc.carleton.ca>

COPYRIGHT ^

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.

THANKS ^

James Duncan for the Tom module and many ideas; the people of the Perl5-Agents mailing list for their support.

syntax highlighting: