Thread::Queue::Queueable

SUMMARY: CONSTR | METHOD | DETAIL: CONSTR | METHOD

## Class Thread::Queue::Queueable

Known Subclasses:
  Thread::Queue::Duplex

Abstract base class defining the interfaces, and providing simple marshalling methods, for complex object to be passed across a Thread::Queue::Duplex queue.

Licensed under the Academic Free License version 2.1, as specified in the License.txt file included in this software package, or at OpenSource.org.

Author:
  D. Arnold
Version:
  0.90
Since:
  2005-12-01

Unless otherwise noted, `$obj` is the object instance variable.

Method Summary
`curse()` Marshal an object into a value that can be passed via a Thread::Queue::Duplex object
`onCancel()` Pure virtual function to apply any object-specific cancel processing
`onDequeue($object)` Unmarshall an object after being dequeued
`onEnqueue()` Marshal an object for queueing to a redeem($object) Unmarshall an object back into its blessed form

Method Details

### curse

    curse()

  Marshal an object into a value that can be passed via a Thread::Queue::Duplex object.

  Called by TQD's various enqueue() and respond() methods when the TQQ object is being enqueue'd. Should return an unblessed, shared version of the input object.

  Default returns a shared arrayref or hashref, depending on the object's base structure, with copies of all scalar members.

  Note that objects with more complex members will need to implement an object specific `curse()` to do any deepcopying, including curse()ing any subordinate objects.

  Returns:
    marshalled version of the object

### onCancel

    onCancel()

  Pure virtual function to apply any object-specific cancel processing. Called by TQD's respond() method when a cancelled operation is detected.

  Returns:
    1

### onDequeue

    onDequeue($object)

  Unmarshall an object after being dequeued. Called by any of TQD's dequeue() methods, as well as the various request side dequeueing methods (e.g., wait()).

  The default implementation redeem()'s the input object to copy the input shared arrayref or hashref into a nonshared equivalent, then blessing it into the specified class, returning the redeemed object.

  Parameters:
    `$object` - the marshalled representation of the object
  Returns:
    the unmarshalled aka "redeemed" object

### onEnqueue

    onEnqueue()

  Marshal an object for queueing to a Thread::Queue::Duplex queue. Called by any of TQD's enqueue() methods, as well as respond() method.

  The default implementation the input object into either a shared array or shared hash (depending on the base structure of the object), and returns a list consisting of the object's class name, and the cursed object.

  Returns:
    (list of (object's class, object's marshalled representation) )

### redeem

    redeem($object)

  Unmarshall an object back into its blessed form.

  Called by TQD's various dequeue() and wait methods to "redeem" (i.e., rebless) the object into its original class.

  Default creates non-shared copy of the input object structure, copying its scalar contents, and blessing it into the specified class.

  Note that objects with complex members need to implement an object specific `redeem()`, possibly recursively redeem()ing subordinate objects (be careful of circular references!)

  Parameters:
    `$object` - marshalled aka "cursed" version of the object
  Returns:
    unmarshalled, blessed version of the object

Generated by psichedoc on Sun Mar 5 11:01:53 2006