NAME

Form::Factory::Control::Role::Value - controls with values

VERSION

version 0.009

DESCRIPTION

This flags a control as having a value. This may belong in Form::Factory::Control directly, but for now it is here.

ATTRIBUTES

value

This is the value set on the control. It is generally the value that "current_value" gets or sets.

METHODS

set_attribute_value

  $control->set_attribute_value($action, $attribute);

Sets the value of the action attribute with current value of teh control.

ROLE METHODS

current_value

  my $value = $control->current_value;
  $control->current_value($new_value);

The current_value method is an accessor and mutator for values on the control. This is different from the "value" attribute as other attributes or values may be involved in determining what the current value is. For example, a text control defines the current_value something like this:

  sub current_value {
      my $self = shift;

      if (@_) {
          $self->value(@_);
      }

      return $self->has_value         ? $self->value
           : $self->has_default_value ? $self->default_value
           :                            ''
           ;
  }

The value will change if set, but the default_value attribute is used if available and it will fall back to an empty string failing that.

AUTHOR

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2009 Qubling Software LLC.

This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.