File Coverage

blib/lib/Data/DynamicValidator/Error.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 3 4 75.0
total 27 28 96.4


line stmt bran cond sub pod time code
1             package Data::DynamicValidator::Error;
2             # ABSTRACT: Class holds validation error: reason and location
3             $Data::DynamicValidator::Error::VERSION = '0.04';
4 9     9   2897 use strict;
  9         18  
  9         217  
5 9     9   60 use warnings;
  9         14  
  9         396  
6              
7 9     9   5974 use overload fallback => 1, q/""/ => sub { $_[0]->to_string };
  9     1   6053  
  9         69  
  1         681  
8              
9             sub new {
10 7     7 0 13 my ($class, $reason, $path) = @_;
11 7         17 my $self = {
12             _reason => $reason,
13             _path => $path,
14             };
15 7         21 bless $self => $class;
16             }
17              
18              
19 1     1 1 5 sub to_string{ $_[0]->{_reason} };
20              
21              
22 3     3 1 508 sub reason { $_[0]->{_reason} };
23              
24              
25              
26 1     1 1 660 sub path { $_[0]->{_path} }
27              
28             1;
29              
30             __END__
31              
32             =pod
33              
34             =encoding UTF-8
35              
36             =head1 NAME
37              
38             Data::DynamicValidator::Error - Class holds validation error: reason and location
39              
40             =head1 VERSION
41              
42             version 0.04
43              
44             =head1 METHODS
45              
46             =head2 to_string
47              
48             Stringizes to reason by default
49              
50             =head2 reason
51              
52             Returns the human-readable error description
53              
54             =head2 path
55              
56             Returns the path object, pointing to the error location
57              
58             =head1 AUTHOR
59              
60             Ivan Baidakou <dmol@gmx.com>
61              
62             =head1 COPYRIGHT AND LICENSE
63              
64             This software is copyright (c) 2017 by Ivan Baidakou.
65              
66             This is free software; you can redistribute it and/or modify it under
67             the same terms as the Perl 5 programming language system itself.
68              
69             =cut