line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package #hide |
2
|
|
|
|
|
|
|
My::User; |
3
|
2
|
|
|
2
|
|
12
|
use base qw(My); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
168
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
60
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
52
|
|
6
|
2
|
|
|
2
|
|
9
|
use utf8; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
16
|
|
|
16
|
1
|
142
|
sub TABLE {'users'} |
9
|
11
|
|
|
11
|
1
|
80
|
sub COLUMNS { [qw(id group_id login_name login_password disabled)] } |
10
|
7
|
|
|
7
|
1
|
81
|
sub WHERE { {disabled => 1} } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#See Params::Check |
13
|
|
|
|
|
|
|
my $_CHECKS = { |
14
|
|
|
|
|
|
|
id => {allow => qr/^\d+$/x}, |
15
|
|
|
|
|
|
|
group_id => {allow => qr/^\d+$/x, default => 1}, |
16
|
|
|
|
|
|
|
disabled => { |
17
|
|
|
|
|
|
|
default => 1, |
18
|
|
|
|
|
|
|
allow => sub { |
19
|
|
|
|
|
|
|
return $_[0] =~ /^[01]$/x; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
}, |
22
|
2
|
|
|
2
|
|
479
|
login_name => {allow => qr/^\p{IsAlnum}{4,12}$/x}, |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
27
|
|
23
|
|
|
|
|
|
|
login_password => { |
24
|
|
|
|
|
|
|
required => 1, |
25
|
|
|
|
|
|
|
allow => sub { $_[0] =~ /^[\w\W]{8,20}$/x; } |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
#... |
29
|
|
|
|
|
|
|
}; |
30
|
41
|
|
|
41
|
1
|
952
|
sub CHECKS {$_CHECKS} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub id { |
33
|
15
|
|
|
15
|
0
|
14728
|
my ($self, $value) = @_; |
34
|
15
|
100
|
|
|
|
47
|
if (defined $value) { #setting value |
35
|
1
|
|
|
|
|
15
|
$self->{data}{id} = $self->_check(id => $value); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#make it chainable |
38
|
0
|
|
|
|
|
0
|
return $self; |
39
|
|
|
|
|
|
|
} |
40
|
14
|
|
66
|
|
|
125
|
$self->{data}{id} //= $self->CHECKS->{id}{default}; #getting value |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |