NAME
DCI::Cast - Base class for Cast classes.
DESCRIPTION
All Cast classes (Roles in typical DCI terminology) inherit from this class. This class provides several key methods.
SYNOPSIS
See the docs for DCI or DCI::Meta::Cast, using this base directly is not recommended.
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.
PUBLIC METHODS
- $class->dci_new( $CORE, $CONTEXT, %STATE )
-
Create a new instance of the cast around the $CORE object with the specified context and state.
- $class->dci_meta()
-
Get the metadata object (Which is an instance of DCI::Meta::Cast.)
- $cast->dci_core()
-
Alias for
dci_true_core
. - $cast->dci_core_type()
-
Alias for
dci_true_core_type
, - $cast->dci_true_core()
-
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_core
if this is not what you want. - $cast->dci_true_core_type()
-
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.
- $cast->dci_direct_core()
-
Get the direct core, even if it is itself a cast object.
- $cast->dci_direct_core_type()
-
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.
- $cast->dci_context()
-
Get the context object with which the cast object was constructed.
- $cast->dci_context_type()
-
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.
- $cast->dci_state()
-
Get the state hash associated with this cast instance.
- $cast->dci_debug()
-
Returns a string detailing the structure of a nested cast
Example:
"Test::Cast( Test::Cast( Test::Core=HASH(0x1f29f28) ))"
ACHNOWLEDGEMENTS
The DCI concept was created by Trygve Reenskaug, (inventor of MVC) and James Coplien.
AUTHORS
Chad Granum exodist7@gmail.com
COPYRIGHT
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.