NAME

Para::Frame::Child::Result - Representing a child process result from CHILDs view

DESCRIPTION

Create a fork using Para::Frame::Request/create_fork.

This is the object that the CHILD gets, that is used to send the result back to the parent.

See Para::Frame::Request/create_fork for examples.

After the CHILD fork is done, you can get this object from the PARENT by Para::Frame::Child/result. The same methods works both in the CHILD and the PARENT, but there is no point modifying the object after CHILD is done.

For example, you may call the object $fork while in the CHILD and $result while in PARENT.

All parts of the object must survive Storable.

new

reset

message

  $fork->message( $message )

If $message is defined adds that message to the message list.

The messages can be anything. For example an object. But it must be something that survive Storable.

In scalar context, returns the last message. In list context, returns all the messages.

return

  $fork->return( $message )

If $message is defined, adds it with /message.

The complete $fork object is frozen with Storable/freeze, including all messages added by /message. The object is sent to the PARENT.

The object is retrieved in the PARENT by Para::Frame::Child/get_results and is there named as the $result object.

exception

  $fork->exception( $exception )

  $result->exception

If $exception is defined adds that exception to the exception list.

The exceptions can be anything. For example an object. But it must be something that survive Storable.

In scalar context, returns the last exception. In list context, returns all the exceptions.

The PARENT will throw an exception with the last element in this list after the the CHILD /return. That will be done in Para::Frame::Child.

on_return

  $fork->on_return( $codename, @args )

  $fork->on_return

Ads code to be run by the PARENT after the CHILD /return.

$codename should be the name of a function to be run. Not a coderef. The function will be looked for in the caller package. That is the package that used this method.

Any @args will be passed as params for the function.

If no $codename is given, it just returns the current on_return value.

In list context, returns a the codename (with package name) and the params as a list. In scalar context, returns a arrayref to the same thing.

pid

  $fork->pid;

Returns the process id of the child.

status

  $result->status

Returns the status number of the CHILD process.

in_child

  $fork->in_child

Returns true

in_parent

  $fork->in_parent

Returns false

AUTHOR

Jonas Liljegren <jonas@paranormal.se>

SEE ALSO

Para::Frame::Request, Para::Frame::Child