NAME
Hyper::Control::Base - base class for all base control classes
VERSION
This document describes Hyper::Control::Base 0.01
SYNOPSIS
package Hyper::Control::Base::BSampleControl;
use Class::Std::Storable;
use base qw(Hyper::Control::Base);
1;
DESCRIPTION
Hyper::Control::Base provides functions like managing single validators, validation, getting value without handling CGI things etc. We provide basicly everything whats needed for base controls.
ATTRIBUTES
- value :set :get
- validator_control :get :set
-
Control which provides validation with methods for Single Validators.
SUBROUTINES/METHODS
set_value
$object->set_value('Damian Conway');
or for multiple values
$object->set_value(['Damian Conway', 'Lary Wall']);
Set value for this object. Also useful for preselection.
clear
$object->clear();
Shortcut to object attribute value to undef.
add_single_validator
$object->add_single_validator(
Hyper::Validator::Single::Required->new()
);
Registers validators in our Validator Control.
join_group_validator
$object->join_group({
group => $self->get_object('vCompareGroupValidator'),
act_as => 'first',
});
Join a validator group with a defined role (act_as).
is_valid
$object->is_valid();
This method communicates with the attached Validator Control. Checks if all registered validators think that the current value of this object is valid. If all validators are valid group validators are checked. Validators whose validation fails will add their error message to the validator field. Method is_valid returns a boolean value.
get_value
my $value = $object->get_value();
or for multiple values
my @values = $object->get_value();
Returns an an array of current values (post/get params) in list config and single value in scalar context. If we have multiple values we also return only one value (the first one) in scalar context.
get_html
Calls template from get_template and sets the param this to $self. Returns $template->output();
Calls populate_show_state to update the control's show_state.
populate_show_state
Informs the the application that element was show via calling the applications method set_show_state. This is used to update the controls value automatically from CGI on an object thaw.
STORABLE_thaw_post :CUMULATIVE
Don't use this method for your code. It's called automaticaly after object was thawn. The method calls _set_from_cgi to fill our object with cgi params.
_set_from_cgi :PRIVATE
$self->_set_from_cgi();
Set our value from cgi if current post/get request has data for our object (parameter name = object name). Setting single and multiple values is supported.
DIAGNOSTICS
CONFIGURATION AND ENVIRONMENT
DEPENDENCIES
version
Class::Std::Storable
Hyper::Control::Template
Hyper::Control
Hyper::Name
List::MoreUtils
Hyper::Singleton::CGI
Hyper::Singleton::Debug
INCOMPATIBILITIES
BUGS AND LIMITATIONS
RCS INFORMATIONS
- Last changed by
-
$Author: ac0v $
- Id
-
$Id: Base.pm 474 2008-05-29 13:25:22Z ac0v $
- Revision
-
$Revision: 474 $
- Date
-
$Date: 2008-05-29 15:25:22 +0200 (Thu, 29 May 2008) $
- HeadURL
-
$HeadURL: file:///srv/cluster/svn/repos/Hyper/Hyper/trunk/lib/Hyper/Control/Base.pm $
AUTHOR
Andreas Specht <ACID@cpan.org>
LICENSE AND COPYRIGHT
Copyright (c) 2007, Andreas Specht <ACID@cpan.org>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.