Dave Rolsky > Chloro > Chloro::Field

Download:
Chloro-0.06.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.06   Source  

NAME ^

Chloro::Field - A field in a form

VERSION ^

version 0.06

SYNOPSIS ^

See Chloro.

DESCRIPTION ^

This class represents a field in a form.

METHODS ^

This class has the following methods:

Chloro::Field->new()

You'll probably make fields by using the field() subroutine exported by Chloro, but you can make one using this constructor.

The constructor accepts the following parameters:

$field->name()

The name as passed to the constructor.

$field->human_name()

A more friendly name, which defaults to the same value as $field->name().

$field->type()

This returns a Moose::Meta::TypeConstraint object, based on the value passed to the constructor in the isa parameter.

$field->default()

The default, as passed to the constructor, if any.

$field->is_required()

Returns a boolean indicating whether the field is required.

$field->is_secure()

Returns a boolean indicating whether the field contains sensitive data.

$field->extractor()

Returns the method used to extract the field's data from the user-submitted parameters. This defaults to _extract_field_value, a method provided by Chloro::Role::Form.

$field->validator()

Returns the method used to extract the field's data from the user-submitted parameters. This defaults to _errors_for_field_value, a method provided by Chloro::Role::Form.

$field->generate_default( $params, $prefix )

Given the user-submitted parameters and an optional prefix, this method returns a default value for the field. If the default is a subroutine reference, that reference will be called with the parameters passed to this method.

$field->dump()

Returns a data structure representing the field definition. This exists primarily for testing.

ROLES ^

This class consumes the Chloro::Role::FormComponent role.

AUTHOR ^

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2011 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: