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 45     45   1097 use strict;
  45         111  
  45         3048  
2              
3             package HTML::FormFu::Constraint::Required;
4             $HTML::FormFu::Constraint::Required::VERSION = '2.07';
5             # ABSTRACT: Required Field Constraint
6              
7 45     45   291 use Moose;
  45         103  
  45         470  
8             extends 'HTML::FormFu::Constraint';
9              
10             sub constrain_value {
11 121     121 0 348 my ( $self, $value ) = @_;
12              
13 121   100     683 return defined $value && length $value;
14             }
15              
16             __PACKAGE__->meta->make_immutable;
17              
18             1;
19              
20             __END__
21              
22             =pod
23              
24             =encoding UTF-8
25              
26             =head1 NAME
27              
28             HTML::FormFu::Constraint::Required - Required Field Constraint
29              
30             =head1 VERSION
31              
32             version 2.07
33              
34             =head1 DESCRIPTION
35              
36             States that a value must be submitted. The empty string is not allowed.
37              
38             =head1 SEE ALSO
39              
40             Is a sub-class of, and inherits methods from L<HTML::FormFu::Constraint>
41              
42             L<HTML::FormFu>
43              
44             =head1 AUTHOR
45              
46             Carl Franks, C<cfranks@cpan.org>
47              
48             Based on the original source code of L<HTML::Widget::Constraint::All>, by
49             Sebastian Riedel, C<sri@oook.de>.
50              
51             =head1 LICENSE
52              
53             This library is free software, you can redistribute it and/or modify it under
54             the same terms as Perl itself.
55              
56             =head1 AUTHOR
57              
58             Carl Franks <cpan@fireartist.com>
59              
60             =head1 COPYRIGHT AND LICENSE
61              
62             This software is copyright (c) 2018 by Carl Franks.
63              
64             This is free software; you can redistribute it and/or modify it under
65             the same terms as the Perl 5 programming language system itself.
66              
67             =cut