HTML::Widget::Constraint::SingleValue - SingleValue Constraint


HTML-Widget documentation Contained in the HTML-Widget distribution.

Index


Code Index:

NAME

Top

HTML::Widget::Constraint::SingleValue - SingleValue Constraint

SYNOPSIS

Top

    my $c = $widget->constraint( 'SingleValue', 'foo' );

DESCRIPTION

Top

Ensures that multiple values were not submitted for the named element.

METHODS

Top

process

AUTHOR

Top

Carl Franks, cfranks@cpan.org

LICENSE

Top

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


HTML-Widget documentation Contained in the HTML-Widget distribution.
package HTML::Widget::Constraint::SingleValue;

use warnings;
use strict;
use base 'HTML::Widget::Constraint';

sub process {
    my ( $self, $w, $params ) = @_;
    my $results = [];
    my ($name) = @{ $self->names };

    if ( ref $params->{$name} ) {
        push @$results, HTML::Widget::Error->new(
            { name => $name, message => $self->mk_message } );
    }

    return $results;
}

1;