line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Valiemon::Attributes; |
2
|
25
|
|
|
25
|
|
86
|
use strict; |
|
25
|
|
|
|
|
24
|
|
|
25
|
|
|
|
|
607
|
|
3
|
25
|
|
|
25
|
|
72
|
use warnings; |
|
25
|
|
|
|
|
21
|
|
|
25
|
|
|
|
|
423
|
|
4
|
25
|
|
|
25
|
|
65
|
use utf8; |
|
25
|
|
|
|
|
22
|
|
|
25
|
|
|
|
|
74
|
|
5
|
|
|
|
|
|
|
|
6
|
25
|
|
|
25
|
|
416
|
use Carp qw(croak); |
|
25
|
|
|
|
|
23
|
|
|
25
|
|
|
|
|
922
|
|
7
|
25
|
|
|
25
|
|
89
|
use Exporter qw(import); |
|
25
|
|
|
|
|
29
|
|
|
25
|
|
|
|
|
656
|
|
8
|
25
|
|
|
25
|
|
9316
|
use Class::Load qw(is_class_loaded try_load_class); |
|
25
|
|
|
|
|
305165
|
|
|
25
|
|
|
|
|
1538
|
|
9
|
25
|
|
|
25
|
|
127
|
use Valiemon::ValidationError; |
|
25
|
|
|
|
|
28
|
|
|
25
|
|
|
|
|
3511
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our @EXPORT_OK = qw(attr); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub attr { |
14
|
1303
|
|
|
1303
|
0
|
1117
|
my ($name) = @_; |
15
|
1303
|
|
|
|
|
1559
|
$name =~ s/^\$//; # TODO have package mappings instead of dinamic load |
16
|
1303
|
|
|
|
|
2894
|
my $class = join '::', __PACKAGE__, (ucfirst $name); |
17
|
1303
|
100
|
|
|
|
2209
|
return $class if is_class_loaded($class); |
18
|
|
|
|
|
|
|
|
19
|
205
|
|
|
|
|
6562
|
my ($is_success) = try_load_class($class); |
20
|
204
|
100
|
|
|
|
30258
|
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; |