line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSV::Result; |
2
|
|
|
|
|
|
|
|
3
|
46
|
|
|
46
|
|
44688
|
use strict; |
|
46
|
|
|
|
|
76
|
|
|
46
|
|
|
|
|
1033
|
|
4
|
46
|
|
|
46
|
|
198
|
use warnings; |
|
46
|
|
|
|
|
67
|
|
|
46
|
|
|
|
|
1779
|
|
5
|
|
|
|
|
|
|
use overload |
6
|
46
|
|
|
|
|
352
|
'bool' => \&to_boolean, |
7
|
46
|
|
|
46
|
|
3253
|
'eq' => \= |
|
46
|
|
|
|
|
2264
|
|
8
|
|
|
|
|
|
|
|
9
|
46
|
|
|
46
|
|
2679
|
use Carp; |
|
46
|
|
|
|
|
92
|
|
|
46
|
|
|
|
|
2795
|
|
10
|
46
|
|
|
46
|
|
47265
|
use Hash::MultiValue; |
|
46
|
|
|
|
|
105459
|
|
|
46
|
|
|
|
|
1655
|
|
11
|
|
|
|
|
|
|
use Class::Accessor::Lite ( |
12
|
46
|
|
|
|
|
369
|
new => 0, |
13
|
|
|
|
|
|
|
rw => [qw/instance error errors/] |
14
|
46
|
|
|
46
|
|
1752
|
); |
|
46
|
|
|
|
|
2265
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
1952
|
|
|
1952
|
0
|
29032
|
my $class = shift; |
18
|
1952
|
50
|
|
|
|
5321
|
my $args = ref $_[0] ? $_[0] : { @_ }; |
19
|
|
|
|
|
|
|
|
20
|
1952
|
|
|
|
|
8239
|
%$args = ( |
21
|
|
|
|
|
|
|
errors => [], |
22
|
|
|
|
|
|
|
error => "", |
23
|
|
|
|
|
|
|
%$args, |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
1952
|
|
|
|
|
6031
|
bless $args => $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub equals { |
31
|
717
|
|
|
717
|
0
|
5915
|
$_[0]->to_boolean == $_[1]; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub to_boolean { |
35
|
739
|
|
|
739
|
0
|
37250
|
my $self = shift; |
36
|
739
|
100
|
100
|
|
|
2598
|
return (($self->errors && scalar @{ $self->errors }) || $self->error) ? 0 : 1; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub get_error { |
40
|
16
|
|
|
16
|
0
|
69
|
my ($self, $pointer) = @_; |
41
|
|
|
|
|
|
|
|
42
|
16
|
100
|
|
|
|
53
|
if ( $self->error ) { |
|
|
50
|
|
|
|
|
|
43
|
1
|
|
|
|
|
8
|
return $self->error; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
elsif ( $self->errors ) { |
46
|
15
|
100
|
|
|
|
186
|
if ( $pointer ) { |
47
|
1
|
|
|
|
|
2
|
return grep { $_->{pointer} eq $pointer } @{ $self->errors }; |
|
2
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
4
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
else { |
50
|
14
|
|
|
|
|
18
|
return @{ $self->errors }; |
|
14
|
|
|
|
|
36
|
|
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub get_error_map { |
56
|
1
|
|
|
1
|
0
|
974
|
my $self = shift; |
57
|
1
|
|
|
|
|
3
|
return Hash::MultiValue->new(map { $_->{pointer} => $_ } @{ $self->errors }); |
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
3
|
|
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |