line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes::Pattern; |
2
|
3
|
|
|
3
|
|
1898
|
use strict; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
92
|
|
3
|
3
|
|
|
3
|
|
18
|
use warnings; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
80
|
|
4
|
3
|
|
|
3
|
|
16
|
use utf8; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
16
|
|
5
|
3
|
|
|
3
|
|
526
|
use parent qw(Valiemon::Attributes); |
|
3
|
|
|
|
|
291
|
|
|
3
|
|
|
|
|
17
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
182
|
use Carp qw(croak); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
575
|
|
8
|
|
|
|
|
|
|
|
9
|
13
|
|
|
13
|
0
|
49
|
sub attr_name { 'pattern' } |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub is_valid { |
12
|
18
|
|
|
18
|
0
|
44
|
my ($class, $context, $schema, $data) = @_; |
13
|
|
|
|
|
|
|
|
14
|
18
|
100
|
|
|
|
51
|
return 1 unless $context->prims->is_string($data); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$context->in_attr($class, sub { |
17
|
13
|
|
|
13
|
|
26
|
my $pattern = $schema->{pattern}; |
18
|
|
|
|
|
|
|
|
19
|
13
|
100
|
|
|
|
39
|
unless ($context->prims->is_string($pattern)) { |
20
|
2
|
|
|
|
|
6
|
croak sprintf '`pattern` must be a string at %s', $context->position |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
11
|
100
|
|
|
|
188
|
$data =~ /$pattern/ ? 1 : 0; |
24
|
13
|
|
|
|
|
78
|
}); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |