line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes; |
2
|
25
|
|
|
25
|
|
169
|
use strict; |
|
25
|
|
|
|
|
50
|
|
|
25
|
|
|
|
|
700
|
|
3
|
25
|
|
|
25
|
|
124
|
use warnings; |
|
25
|
|
|
|
|
56
|
|
|
25
|
|
|
|
|
577
|
|
4
|
25
|
|
|
25
|
|
116
|
use utf8; |
|
25
|
|
|
|
|
52
|
|
|
25
|
|
|
|
|
125
|
|
5
|
|
|
|
|
|
|
|
6
|
25
|
|
|
25
|
|
661
|
use Carp qw(croak); |
|
25
|
|
|
|
|
72
|
|
|
25
|
|
|
|
|
1361
|
|
7
|
25
|
|
|
25
|
|
156
|
use Exporter qw(import); |
|
25
|
|
|
|
|
55
|
|
|
25
|
|
|
|
|
1205
|
|
8
|
25
|
|
|
25
|
|
11390
|
use Class::Load qw(is_class_loaded try_load_class); |
|
25
|
|
|
|
|
443929
|
|
|
25
|
|
|
|
|
1559
|
|
9
|
25
|
|
|
25
|
|
195
|
use Valiemon::ValidationError; |
|
25
|
|
|
|
|
55
|
|
|
25
|
|
|
|
|
4973
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw(attr); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub attr { |
14
|
1314
|
|
|
1314
|
0
|
2411
|
my ($name) = @_; |
15
|
1314
|
|
|
|
|
2813
|
$name =~ s/^\$//; # TODO have package mappings instead of dinamic load |
16
|
1314
|
|
|
|
|
4531
|
my $class = join '::', __PACKAGE__, (ucfirst $name); |
17
|
1314
|
100
|
|
|
|
3320
|
return $class if is_class_loaded($class); |
18
|
|
|
|
|
|
|
|
19
|
202
|
|
|
|
|
10208
|
my ($is_success) = try_load_class($class); |
20
|
202
|
100
|
|
|
|
42002
|
return $is_success ? $class : undef; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub attr_name { |
24
|
0
|
|
|
0
|
0
|
|
croak '`attr_name` method must be implemented'; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub is_valid { |
28
|
0
|
|
|
0
|
0
|
|
my ($class, $context, $schema, $data) = @_; |
29
|
0
|
|
|
|
|
|
croak '`is_valid` method must be implemented'; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |