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