Apache::Wyrd::Input::Complex - Abstract class for more complex Wyrds (hashes/structures)
NONE
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.
Apache::Wyrd::Input::Condenser
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.
see Apache::Wyrd::Input for "normal" Input Wyrd behavior. The methods requiring overriding are (in the order of recommended implementation):
Apache::Wyrd::Input
default
This should return the default, or baseline, data structure.
current_value
This should return the data structure based on the current state of CGI.
check
This should accept the data structure and return (1, undef) if OK, (undef, "error message") if not.
set
This should accept the data structure , call check, and parent->register_errors, parent->register_error_messages when there are errors, and set the value that value returns.
parent->register_errors
parent->register_error_messages
value
This should return the data structure.
final_output
This should manipulate _template to produce the appropriate HTML. By default, _template is defined as the enclosed text.
_get_value
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.
Reserves the _setup, _format_output, and _generate_output. Also overerides the register_input and _parse_options methods from Apache::Wyrd::Input. methods.
_setup
_format_output
_generate_output
Barry King <wyrd@nospam.wyrdwright.com>
General-purpose HTML-embeddable perl object
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for Apache::Wyrd.
Apache::Wyrd
3 POD Errors
The following errors were encountered while parsing the POD:
'=item' outside of any '=over'
Expected text after =item, not a bullet
You forgot a '=back' before '=head1'
To install Apache::Wyrd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Wyrd
CPAN shell
perl -MCPAN -e shell install Apache::Wyrd
For more information on module installation, please visit the detailed CPAN module installation guide.