DCI::Cast - Base class for Cast classes.
All Cast classes (Roles in typical DCI terminology) inherit from this class. This class provides several key methods.
METHODS TO KEEP IN MIND
These methods need to be kept in mind. If you choose to override them you could break functionality.
- $class_or_self->isa( $TYPE )
isa()has been overriden so that it first calls isa() on the Cast class, then if that returns false, calls isa on the core object. You probably do not want to override this.
- $class->dci_new( $CORE, $CONTEXT, %STATE )
Create a new instance of the cast around the $CORE object with the specified context and state.
Get the metadata object (Which is an instance of DCI::Meta::Cast.)
Returns the core object around which the cast was constructed. When Casts are nested, the inner-most core object will be returned. See
dci_direct_coreif this is not what you want.
Returns the type of the inner-most core object. Will return the package to which the object has been blessed, or the ref type if it is not blessed.
Get the direct core, even if it is itself a cast object.
Returns the type of the core object. Will return the package to which the object has been blessed, or the ref type if it is not blessed.
Get the context object with which the cast object was constructed.
Get the type of the context object. Will return the package to which the object has been blessed, or the ref type if it is not blessed.
Get the state hash associated with this cast instance.
Returns a string detailing the structure of a nested cast
"Test::Cast( Test::Cast( Test::Core=HASH(0x1f29f28) ))"
The DCI concept was created by Trygve Reenskaug, (inventor of MVC) and James Coplien.
Chad Granum email@example.com
Copyright (C) 2011 Chad Granum
DCI is free software; Standard perl licence.
DCI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.