File Coverage

blib/lib/Data/Seek/Exception/RootInvalid.pm
Criterion Covered Total %
statement 3 15 20.0
branch 0 4 0.0
condition 0 2 0.0
subroutine 1 2 50.0
pod n/a
total 4 23 17.3


line stmt bran cond sub pod time code
1             # ABSTRACT: Data::Seek Invalid Root Exception Class
2             package Data::Seek::Exception::RootInvalid;
3              
4 4     4   754 use Data::Object::Class;
  4         10347  
  4         20  
5              
6             extends 'Data::Seek::Exception';
7              
8             our $VERSION = '0.06'; # VERSION
9              
10             has 'criterion', is => 'ro';
11             has 'separator', is => 'ro';
12             has 'subject', is => 'ro';
13             has 'target', is => 'ro';
14              
15             has 'is_array', is => 'ro';
16             has 'is_ending', is => 'ro';
17             has 'is_hash', is => 'ro';
18             has 'is_match', is => 'ro';
19              
20             sub _build_message {
21 0     0     my $self = shift;
22 0           my $is_array = $self->is_array;
23 0           my $is_hash = $self->is_hash;
24              
25 0 0         my $type = $is_hash ? 'AN OBJECT' : $is_array ? 'A LIST' : 'INVALID';
    0          
26              
27 0           my $criterion = $self->criterion;
28 0   0       my $separator = $self->separator // ' -> ';
29 0           my $subject = join $separator, @{$self->subject};
  0            
30 0           my $target = join $separator, @{$self->target};
  0            
31              
32 0           my $message = join ' ',
33             'ERROR MATCHING CRITERION (%s):',
34             'INVALID ENDING OF ROOT DATA/NODE (%s)',
35             'WHILE SEEKING (%s), NODE VALUE IS %s (NOT A STRING)';
36              
37 0           return sprintf $message, $criterion, $subject, $target, $type;
38             }
39              
40             1;
41              
42             __END__