File Coverage

blib/lib/Data/Seek/Exception/NodeInvalid.pm
Criterion Covered Total %
statement 3 18 16.6
branch 0 4 0.0
condition 0 2 0.0
subroutine 1 2 50.0
pod n/a
total 4 26 15.3


line stmt bran cond sub pod time code
1             # ABSTRACT: Data::Seek Invalid Node Exception Class
2             package Data::Seek::Exception::NodeInvalid;
3              
4 3     3   24 use Data::Object::Class;
  3         3  
  3         12  
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 'was_array', is => 'ro';
16             has 'was_ending', is => 'ro';
17             has 'was_hash', is => 'ro';
18             has 'was_match', is => 'ro';
19              
20             sub _build_message {
21 0     0     my $self = shift;
22 0           my $was_array = $self->was_array;
23 0           my $was_hash = $self->was_hash;
24              
25 0 0         my $type = $was_hash ? 'AN OBJECT' : $was_array ? 'A LIST' : 'INVALID';
    0          
26              
27 0           my @subject = @{$self->subject};
  0            
28 0           my @target = @{$self->target};
  0            
29 0           my $ending = pop @subject;
30 0           my $criterion = $self->criterion;
31 0   0       my $separator = $self->separator // ' -> ';
32 0           my $subject = join $separator, @subject;
33 0           my $target = join $separator, @target;
34              
35 0           my $message = join ' ',
36             'ERROR MATCHING CRITERION (%s):',
37             'INVALID ENDING AT CHILD DATA/NODE (%s)',
38             'UNDER (%s) WHILE SEEKING (%s), NODE VALUE IS %s (NOT A STRING)';
39              
40 0           return sprintf $message, $criterion, $ending, $subject, $target, $type;
41             }
42              
43             1;
44              
45             __END__