File Coverage

blib/lib/HTML/FormFu/Constraint/Required.pm
Criterion Covered Total %
statement 8 8 100.0
branch n/a
condition 3 3 100.0
subroutine 3 3 100.0
pod 0 1 0.0
total 14 15 93.3


line stmt bran cond sub pod time code
1             package HTML::FormFu::Constraint::Required;
2              
3 45     45   701 use strict;
  45         66  
  45         2865  
4             our $VERSION = '2.05'; # VERSION
5              
6 45     45   174 use Moose;
  45         55  
  45         425  
7             extends 'HTML::FormFu::Constraint';
8              
9             sub constrain_value {
10 121     121 0 179 my ( $self, $value ) = @_;
11              
12 121   100     563 return defined $value && length $value;
13             }
14              
15             __PACKAGE__->meta->make_immutable;
16              
17             1;
18              
19             __END__
20              
21             =head1 NAME
22              
23             HTML::FormFu::Constraint::Required - Required Field Constraint
24              
25             =head1 VERSION
26              
27             version 2.05
28              
29             =head1 DESCRIPTION
30              
31             States that a value must be submitted. The empty string is not allowed.
32              
33             =head1 SEE ALSO
34              
35             Is a sub-class of, and inherits methods from L<HTML::FormFu::Constraint>
36              
37             L<HTML::FormFu>
38              
39             =head1 AUTHOR
40              
41             Carl Franks, C<cfranks@cpan.org>
42              
43             Based on the original source code of L<HTML::Widget::Constraint::All>, by
44             Sebastian Riedel, C<sri@oook.de>.
45              
46             =head1 LICENSE
47              
48             This library is free software, you can redistribute it and/or modify it under
49             the same terms as Perl itself.
50              
51             =cut