NAME

Exobrain::Agent - Agent role for Exobrain agents

VERSION

version 1.08

SYNOPSIS

    use Moose;
    with 'Exobrain::Agent';

DESCRIPTION

This role provides a number of utility methods and attributes to Exobrain agents. Most agents will prefer to use the Exobrain::Agent::Poll or Exobrain::Agent::Run roles instead, and which in turn consume this role and hence provide its functionality.

Where possible, all attributes provided by this role are lazily generated, including lazily loading modules.

METHODS

exobrain

    $self->exobrain->watch_loop(...);

Returns an Exobrain object.

component

    my $component = $self->component;

Exobrain components all share the same configuration and cache, and are often packaged as separate distributions. This method returns the current component name.

By default this is the same as the class name with 'Exobrain::Agent::' stripped off. Agents and roles which are part of a specific component should override this attribute (or supply their own default).

config

    my $user = $self->config->{user};

Returns the config for our current component. Use $self-exobrain->config> instead if you want the top-level config.

cache

    my $cache = $self->cache;

Returns an Exobrain::Cache object, with a namespace of $self-component>.

json

    my $json = $self->json;

Returns a JSON::Any object.

AUTHOR

Paul Fenwick <pjf@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Paul Fenwick.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.