NAME

POE::Component::Supervisor::Supervised - A role for supervision descriptors.

VERSION

version 0.09

SYNOPSIS

# See e.g. POE::Component::Supervisor::Supervised::Proc;

DESCRIPTION

All children supervised by the POE::Component::Supervisor must compose this role.

This role provides an API for instantiating POE::Component::Supervisor::Handle as required by the supervisor, corresponding to living instances of the child. The POE::Component::Supervisor::Supervised objects serve as descriptors for these handles, and know how to spawn the actual child.

ATTRIBUTES

restart_policy

One of permanent, transient or temporary.

Defaults to transient.

See should_restart.

handle_class

This attribute should be extended by your class to provide a default for _inherit_attributes_from_handle_class (and subsequently create_handle) to work.

METHODS

construct_handle

Calls new on handle_class with the arguments.

create_handle

Iterates the inherited attributes and copies them from the $self, and also passes $self as the child parameter, along with all provided arguments to construct_handle.

should_restart

Returns a boolean value, which instructs the supervisor as to whether or not the child should be restarted after exit.

If the child is permanent this always returns true.

If the child is transient this returns true if is_abnormal_exit returns true.

If the child is temporary this returns false.

is_abnormal_exit %args

Required.

Given exit arguments from the handle, check whether or not the exit was normal or not.

For example POE::Component::Supervisor::Supervised::Proc will by default check if the exit status is 0.

Only applies to transient children.

spawn

Required.

Creates a new POE::Component::Supervisor::Handle object for the supervisor.

respawn

An alias for spawn by default.

May be overridden if respawning requires cleanup first, or something like that.

is_transient
is_temporary
is_permanent

Boolean query methods that operate on restart_policy.