line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Result; |
2
|
|
|
|
|
|
|
|
3
|
49
|
|
|
49
|
|
28995
|
use strict; |
|
49
|
|
|
|
|
50
|
|
|
49
|
|
|
|
|
1067
|
|
4
|
49
|
|
|
49
|
|
155
|
use warnings; |
|
49
|
|
|
|
|
44
|
|
|
49
|
|
|
|
|
1694
|
|
5
|
|
|
|
|
|
|
use overload |
6
|
49
|
|
|
|
|
328
|
'bool' => \&to_boolean, |
7
|
49
|
|
|
49
|
|
1998
|
'eq' => \= |
|
49
|
|
|
|
|
1639
|
|
8
|
|
|
|
|
|
|
|
9
|
49
|
|
|
49
|
|
2380
|
use Carp; |
|
49
|
|
|
|
|
57
|
|
|
49
|
|
|
|
|
2155
|
|
10
|
49
|
|
|
49
|
|
20560
|
use Hash::MultiValue; |
|
49
|
|
|
|
|
77709
|
|
|
49
|
|
|
|
|
1565
|
|
11
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
12
|
49
|
|
|
|
|
293
|
new => 0, |
13
|
|
|
|
|
|
|
rw => [qw/instance error errors/] |
14
|
49
|
|
|
49
|
|
1062
|
); |
|
49
|
|
|
|
|
2175
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
2017
|
|
|
2017
|
0
|
19046
|
my $class = shift; |
18
|
2017
|
50
|
|
|
|
3045
|
my $args = ref $_[0] ? $_[0] : { @_ }; |
19
|
|
|
|
|
|
|
|
20
|
2017
|
|
|
|
|
5378
|
%$args = ( |
21
|
|
|
|
|
|
|
errors => [], |
22
|
|
|
|
|
|
|
error => "", |
23
|
|
|
|
|
|
|
%$args, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
2017
|
|
|
|
|
3727
|
bless $args => $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub equals { |
31
|
757
|
|
|
757
|
0
|
4821
|
$_[0]->to_boolean == $_[1]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub to_boolean { |
35
|
779
|
|
|
779
|
0
|
23317
|
my $self = shift; |
36
|
779
|
100
|
100
|
|
|
1631
|
return (($self->errors && scalar @{ $self->errors }) || $self->error) ? 0 : 1; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub get_error { |
40
|
16
|
|
|
16
|
0
|
50
|
my ($self, $pointer) = @_; |
41
|
|
|
|
|
|
|
|
42
|
16
|
100
|
|
|
|
26
|
if ( $self->error ) { |
|
|
50
|
|
|
|
|
|
43
|
1
|
|
|
|
|
6
|
return $self->error; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
elsif ( $self->errors ) { |
46
|
15
|
100
|
|
|
|
126
|
if ( $pointer ) { |
47
|
1
|
|
|
|
|
1
|
return grep { $_->{pointer} eq $pointer } @{ $self->errors }; |
|
2
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
3
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
else { |
50
|
14
|
|
|
|
|
10
|
return @{ $self->errors }; |
|
14
|
|
|
|
|
20
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub get_error_map { |
56
|
1
|
|
|
1
|
0
|
728
|
my $self = shift; |
57
|
1
|
|
|
|
|
2
|
return Hash::MultiValue->new(map { $_->{pointer} => $_ } @{ $self->errors }); |
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
2
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |