line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes; |
2
|
19
|
|
|
19
|
|
89
|
use strict; |
|
19
|
|
|
|
|
42
|
|
|
19
|
|
|
|
|
611
|
|
3
|
19
|
|
|
19
|
|
90
|
use warnings; |
|
19
|
|
|
|
|
25
|
|
|
19
|
|
|
|
|
787
|
|
4
|
19
|
|
|
19
|
|
90
|
use utf8; |
|
19
|
|
|
|
|
28
|
|
|
19
|
|
|
|
|
167
|
|
5
|
|
|
|
|
|
|
|
6
|
19
|
|
|
19
|
|
562
|
use Carp qw(croak); |
|
19
|
|
|
|
|
28
|
|
|
19
|
|
|
|
|
1374
|
|
7
|
19
|
|
|
19
|
|
95
|
use Exporter qw(import); |
|
19
|
|
|
|
|
39
|
|
|
19
|
|
|
|
|
772
|
|
8
|
19
|
|
|
19
|
|
11653
|
use Class::Load qw(is_class_loaded try_load_class); |
|
19
|
|
|
|
|
392651
|
|
|
19
|
|
|
|
|
1634
|
|
9
|
19
|
|
|
19
|
|
174
|
use Valiemon::ValidationError; |
|
19
|
|
|
|
|
34
|
|
|
19
|
|
|
|
|
4218
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw(attr); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub attr { |
14
|
364
|
|
|
364
|
0
|
508
|
my ($name) = @_; |
15
|
364
|
|
|
|
|
741
|
$name =~ s/^\$//; # TODO have package mappings instead of dinamic load |
16
|
364
|
|
|
|
|
1415
|
my $class = join '::', __PACKAGE__, (ucfirst $name); |
17
|
364
|
100
|
|
|
|
1067
|
return $class if is_class_loaded($class); |
18
|
|
|
|
|
|
|
|
19
|
52
|
|
|
|
|
2981
|
my ($is_success) = try_load_class($class); |
20
|
52
|
100
|
|
|
|
14448
|
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; |