line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
502
|
use v5.10; |
|
1
|
|
|
|
|
3
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
{ |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package PrettyRegistationForm; |
8
|
1
|
|
|
1
|
|
549
|
use Form::Tiny; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
7
|
|
9
|
1
|
|
|
1
|
|
6
|
use Types::Standard qw(Enum); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
10
|
1
|
|
|
1
|
|
2062
|
use Types::Common::Numeric qw(IntRange); |
|
1
|
|
|
|
|
23719
|
|
|
1
|
|
|
|
|
10
|
|
11
|
1
|
|
|
1
|
|
853
|
use Types::Common::String qw(SimpleStr StrongPassword StrLength); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my %password = ( |
14
|
|
|
|
|
|
|
type => StrongPassword, |
15
|
|
|
|
|
|
|
required => 1, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
form_field "username" => ( |
19
|
|
|
|
|
|
|
type => SimpleStr & StrLength [4, 30], |
20
|
|
|
|
|
|
|
required => 1, |
21
|
|
|
|
|
|
|
adjust => sub { ucfirst pop }, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
form_field "password" => %password; |
25
|
|
|
|
|
|
|
form_field "repeat_password" => %password; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# can be a full date with Types::DateTime |
28
|
|
|
|
|
|
|
form_field "year_of_birth" => ( |
29
|
|
|
|
|
|
|
type => IntRange [1900, 1900 + (localtime)[5]], |
30
|
|
|
|
|
|
|
required => 1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
form_field "sex" => ( |
34
|
|
|
|
|
|
|
type => Enum [qw(male female other)], |
35
|
|
|
|
|
|
|
required => 1, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
form_cleaner sub { |
39
|
|
|
|
|
|
|
my ($self, $data) = @_; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$self->add_error("passwords are not identical") |
42
|
|
|
|
|
|
|
if $data->{password} ne $data->{repeat_password}; |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
} |