Apache::Wyrd::Input::Complex - Abstract class for more complex Wyrds (hashes/structures)
Occasionally, an Input is needed which is too complicated to reduce to a single parameter or control. These might be items in a sub-table or otherwise related information to the main information being requested. If it can be reduced to a single data structure, such as an arrayref to an array of hashes, it can be handled by the Complex Input Wyrd.
Form objects need a certain behavior out of the Inputs they handle. The form will be calling certain methods and expecting certain outcomes. This module abstract-ifies those requirements and consists of hook methods which must be overridden in a subclass. The normal behavior of these methods is to cause an exception to be raised and to emit an error message concerning the method which requires overriding.
Another implementation of the Complex Input is available which simply combines the values of all classic "inputs" into a single hashref. See
Apache::Wyrd::Input::Condenser. This will be suitable for many complex operations, so try it first before implementing a complex Input object from scratch.
In the documentation below, the indeterminate structure that the data this Input represents is denoted by STRUCTURE.
unlike other Input Wyrds, Complex does not handle standard attributes such as class and onselect, except as implemented by the developer.
As is, there are no default attributes other than:
The name of the Complex Input.
Apache::Wyrd::Input for "normal" Input Wyrd behavior. The methods requiring overriding are (in the order of recommended implementation):
This should return the default, or baseline, data structure.
This should return the data structure based on the current state of CGI.
This should accept the data structure and return (1, undef) if OK, (undef, "error message") if not.
This should accept the data structure , call
parent->register_error_messages when there are errors, and set the value that
This should return the data structure.
This should manipulate _template to produce the appropriate HTML. By default, _template is defined as the enclosed text.
Don't subclass this one unless you know what you're doing. Is normally implemented only to return undef to any attempt to set a sub-Input's value by default.
_generate_output. Also overerides the register_input and _parse_options methods from
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