1HTML::FormHandler::TypeUss(e3r)Contributed Perl DocumentHaTtMiLo:n:FormHandler::Types(3)
2
3
4
6 HTML::FormHandler::Types - Moose type constraints
7
9 version 0.40068
10
12 These types are provided by MooseX::Types. These types must not be
13 quoted when they are used:
14
15 has 'posint' => ( is => 'rw', isa => PositiveInt);
16 has_field 'email' => ( apply => [ Email ] );
17
18 Types declared using Moose::Util::TypeConstraints, on the other hand,
19 must be quoted:
20
21 has_field 'text_both' => ( apply => [ PositiveInt, 'GreaterThan10' ] );
22
23 To import these types into your forms, you must either specify (':all')
24 or list the types you want to use:
25
26 use HTML::FormHandler::Types (':all');
27
28 or:
29
30 use HTML::FormHandler::Types ('Email', 'PositiveInt');
31
33 It would be possible to import the MooseX types (Common, etc), but for
34 now we'll just re-implement them here in order to be able to change the
35 messages and keep control of what types we provide.
36
37 From MooseX::Types::Common:
38
39 'PositiveNum', 'PositiveInt', 'NegativeNum', 'NegativeInt', 'SingleDigit',
40 'SimpleStr', 'NonEmptySimpleStr', 'Password', 'StrongPassword', 'NonEmptyStr',
41
43 These types check the value and issue an error message.
44
45 Email
46 Uses Email::Valid
47
48 State
49 Checks that the state is in a list of two uppercase letters.
50
51 Zip
52 IPAddress
53 Must be a valid IPv4 address.
54
55 NoSpaces
56 No spaces in string allowed.
57
58 WordChars
59 Must be made up of letters, digits, and underscores.
60
61 NotAllDigits
62 Might be useful for passwords.
63
64 Printable
65 Must not contain non-printable characters.
66
67 SingleWord
68 Contains a single word.
69
70 Type Coercions
71 These types will transform the value without an error message;
72
73 Collapse
74 Replaces multiple spaces with a single space
75
76 Upper
77 Makes the string all upper case
78
79 Lower
80 Makes the string all lower case
81
82 Trim
83 Trims the string of starting and ending spaces
84
86 FormHandler Contributors - see HTML::FormHandler
87
89 This software is copyright (c) 2017 by Gerda Shank.
90
91 This is free software; you can redistribute it and/or modify it under
92 the same terms as the Perl 5 programming language system itself.
93
94
95
96perl v5.34.0 2022-01-21 HTML::FormHandler::Types(3)