View on
MetaCPAN
Barry King > Apache-Wyrd > Apache::Wyrd::Input::Complex

Download:
Apache-Wyrd-0.98.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.98   Source  

NAME ^

Apache::Wyrd::Input::Complex - Abstract class for more complex Wyrds (hashes/structures)

SYNOPSIS ^

        NONE

DESCRIPTION ^

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.

HTML ATTRIBUTES

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:

name

The name of the Complex Input.

PERL METHODS

see Apache::Wyrd::Input for "normal" Input Wyrd behavior. The methods requiring overriding are (in the order of recommended implementation):

(STRUCTURE) default (void)

This should return the default, or baseline, data structure.

(STRUCTURE) current_value (void)

This should return the data structure based on the current state of CGI.

(scalar, scalar) check (STRUCTURE)

This should accept the data structure and return (1, undef) if OK, (undef, "error message") if not.

(void) set (STRUCTURE)

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.

(STRUCTURE) value (void)

This should return the data structure.

(scalar) final_output (void)

This should manipulate _template to produce the appropriate HTML. By default, _template is defined as the enclosed text.

(scalar) _get_value (Apache::Wyrd::Input)

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.

BUGS/CAVEATS/RESERVED METHODS ^

Reserves the _setup, _format_output, and _generate_output. Also overerides the register_input and _parse_options methods from Apache::Wyrd::Input. methods.

AUTHOR ^

Barry King <wyrd@nospam.wyrdwright.com>

SEE ALSO ^

Apache::Wyrd

General-purpose HTML-embeddable perl object

LICENSE ^

Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.

See LICENSE under the documentation for Apache::Wyrd.

syntax highlighting: