Form::Factory::Control::Role::BooleanValue - boolean valued controls


Form-Factory documentation  | view source Contained in the Form-Factory distribution.

Index


NAME

Top

Form::Factory::Control::Role::BooleanValue - boolean valued controls

VERSION

Top

version 0.020

DESCRIPTION

Top

Controls that implement this role have a boolean value. This say much about how that is actually implemented, just that is has a true_value a false_value and then a flag stating whether the true value or false value is currently selected.

ATTRIBUTES

Top

true_value

The string value the control should have when the control is_true.

false_value

The string value the control should have when the control is not is_true.

METHODS

Top

is_currently_true

Returns a true value when the current_value is set to true_value or a false value when the current_value is set to false_value.

This method returns undef if it is neither true nor false.

If passed a value, e.g.:

  $self->is_currently_true(1);

This will set the current_value. If a true value is given, the value will be set to true_value. Otherwise, it will cause the current_value to take on the contents of false_value.

is_true

Returns a true value when the value is set to true_value or a false value when the value is set to false_value.

This method returns undef if it is neither true nor false.

Unlikely is_currently_true, this may not be used as a setter.

current_value

We need to handle current value special.

has_current_value

If the value is true or false, it has a current value. Otherwise, it does not.

AUTHOR

Top

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

Top


Form-Factory documentation  | view source Contained in the Form-Factory distribution.