| DSlib documentation | view source | Contained in the DSlib distribution. |
DS::Transformer - receives, transforms and passes on rows
This class is the base class of all transformers in DS. If you need to write a transformer, first consider if DS::Transformer::Sub will do. It supports any kind of row-wise transformations where there is a one-to-one correspondence between incoming and outgoing rows.
DS::Transformer is a mixin of DS::Source and DS::Target.
Method for processing of ingoing data. This method is supposed
to be overridden. By default it will return $row.
Constructor. Instantiates an object of class $class, taking the
type $in_type, returning the type $out_type, attached to the source
$source and attaced to the target $target. Besides $class,
any of the parameters can be left out.
Attaches target $target to this object. This method also triggers
type checking, ensuring that the outgoing type of this object is
sufficient for $target. If the type check fails, an exception
is thrown.
This is a method mostly for internal use. It will get or set the target, bypassing type checks.
Calling this metod will cause the transformer to pass $row to the target
$target.
This is an accessor that gets or sets the outgoing type of this object.
Triggers processing of $row. This method calls process with
$row, and then passes the result to pass_row.
Attaches $source as source. This method also validates data types
by calling validate_source_type, throwing an exception if the
validation fails.
Accessor for source. This method sets the source of this object and triggers type checking.
Validates source type. If the $source_type is not valid, it returns
false, true otherwise. By default, this method ensures that the ingoing
type of this object contains no fields not specified in $source_type.
Override if you need more complex checking.
Accessor for ingoing type.
DS::Transformer::Sub, DS::Source, DS::Target.
Written by Michael Zedeler.
| DSlib documentation | view source | Contained in the DSlib distribution. |