Apache::Wyrd::Interfaces::Mother - Reverse-parsing interface for Wyrds
If the enclosing Wyrd is the parent of an enclosed wyrd,
the Mother interface allows "children" of a Wyrd to be processed AFTER the parent,
reversing the normal flow of interpretation and calling the
This is used,
Apache::Wyrd::Form will need to alter values in the enclosed
Apache::Wyrd::Inputs and similar children after they have been parsed.
To accomplish this,
every child must call the
This will give the mother a private attribute
_children containing an arrayref to the child objects.
When the mother has manipulated its children via access to the
_set_children to output the children to their place within the enclosed HTML.
For this to function,
each child must have a
final_output method to call,
and must output
'$:'+ the id returned by the
Typically this is done with the following code:
$self->_data('$:' . $id);
(format: (returns) name (accepts))
Prior to producing output, the mother should, assuming
_data contains the enclosed data at the time, call
_set_children to perform the delayed processing of its children. Set children operates on the _data attribute, so be sure the children's placemarkers are in _data before calling this method.
When used with the optional argument, that attribute is assumed to be the storage place for the children rather than _data.
Adds the child to the mother's
_children attribute and returns a placemarker string the mother will use to find it. Every child of the mother should call register_child. In so doing, it should set it's output (usually during the
_generate_output phase) with the string "$:idname" where idname is the id returned by this method. It can do this in any way it likes, for example by replacing it's _data attribute, as long as it's
output method returns this value.
Hook method for performing some action on or using each child.
_child_hash are reserved by this interface.
Children must ensure that the '$:' string before the ID string is not interpreted by perl as the $: variable, i.e. use single quotes/q() around the string. See
Barry King <firstname.lastname@example.org>
General-purpose HTML-embeddable perl object
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for