יובל קוג'מן (Yuval Kogman) > POE-Component-ResourcePool-0.04 > POE::Component::ResourcePool::Request

Download:
POE-Component-ResourcePool-0.04.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  1
Open  0
View/Report Bugs
Source  

NAME ^

POE::Component::ResourcePool::Request - A bundle of resource request parameters.

SYNOPSIS ^

        $pool->request(
                # specify what you want
                params => {
                        resource_name  => ...,
                        other_resource => ...,
                },

                # specify what to do when you've got what you want
                event => "moose",

        );

DESCRIPTION ^

The request object represents a bundle of required resources in the queue.

A request will wait in a pool's queue until sufficient resources are available to dispatch them, at which point its callback will be triggerred.

RESOURCE MANAGEMENT ^

A request can be deallocated by calling dismiss, returning the allocated value to the resource.

When a resource is garbage collected it will call dismiss automatically.

dismiss can also be called before the request is fulfilled in order to cancel it.

METHODS ^

new

Create a new request

dismiss

If the request has already been fulfilled then deallocate it, otherwise cancel it.

dismissed

Returns a boolean value denoting whether or not the request has been dismissed.

fulfilled

Returns a boolean value denoting whether or not the request has been fulfilled.

canceled

Returns a boolean value denoting whether or not the request has been canceled (dismissed but not fulfilled).

ATTRIBUTES ^

callback

The callback to call when the request is fulfilled.

See also the event attribute.

event

An event name to post to on the currently active session at the time of the resource's creation. Used to generate a default callback.

session_id

THe ID of the currently active session at the time of the resource's creation. Used to generate a default callback and to increment the reference count of sessions waiting on resources.

If the current session is not the session that the request should be associated with then this parameter may be specified, but in general that is discouraged.

syntax highlighting: