File Coverage

blib/lib/Data/Seek/Exception/NodeUnknown.pm
Criterion Covered Total %
statement 12 24 50.0
branch n/a
condition 0 2 0.0
subroutine 4 5 80.0
pod n/a
total 16 31 51.6


line stmt bran cond sub pod time code
1             # ABSTRACT: Data::Seek Unknown Node Exception Class
2             package Data::Seek::Exception::NodeUnknown;
3              
4 5     5   1616 use 5.10.0;
  5         16  
  5         886  
5              
6 5     5   26 use strict;
  5         6  
  5         143  
7 5     5   26 use warnings;
  5         8  
  5         168  
8              
9 5     5   1907 use Mo;
  5         1335  
  5         28  
10              
11             extends 'Data::Seek::Exception';
12              
13             our $VERSION = '0.05'; # VERSION
14              
15             has 'criterion';
16             has 'separator';
17             has 'subject';
18             has 'target';
19              
20             has 'was_array';
21             has 'was_ending';
22             has 'was_hash';
23             has 'was_match';
24              
25             sub _build_message {
26 0     0     my $self = shift;
27              
28 0           my @subject = @{$self->subject};
  0            
29 0           my @target = @{$self->target};
  0            
30 0           my $ending = pop @subject;
31 0           my $criterion = $self->criterion;
32 0   0       my $separator = $self->separator // ' -> ';
33 0           my $subject = join $separator, @subject;
34 0           my $target = join $separator, @target;
35              
36 0           my $message = join ' ',
37             'ERROR MATCHING CRITERION (%s):',
38             'NO CHILD DATA/NODE (%s) FOUND AT (%s) WHILE SEEKING (%s)';
39              
40 0           return sprintf $message, $criterion, $ending, $subject, $target;
41             }
42              
43             1;
44              
45             __END__
46              
47             =pod
48              
49             =encoding UTF-8
50              
51             =head1 NAME
52              
53             Data::Seek::Exception::NodeUnknown - Data::Seek Unknown Node Exception Class
54              
55             =head1 VERSION
56              
57             version 0.05
58              
59             =head1 SYNOPSIS
60              
61             use Data::Seek::Exception::NodeInvalid;
62              
63             =head1 DESCRIPTION
64              
65             Data::Seek::Exception::NodeInvalid is an exception class within L<Data::Seek>
66             which is thrown when a criterion references a child node within the introspected
67             data structure which does not exist.
68              
69             =head1 ATTRIBUTES
70              
71             =head2 criterion
72              
73             $exception->criterion;
74              
75             The criterion used against the data which resulted in the exception.
76              
77             =head2 separator
78              
79             $exception->separator;
80              
81             The separator used to denote the hierarchy of the match data and the criterion.
82              
83             =head2 subject
84              
85             $exception->subject;
86              
87             The hierarchy of the match data as an array reference.
88              
89             =head2 target
90              
91             $exception->target;
92              
93             The hierarchy of the criterion as an array reference.
94              
95             =head2 was_array
96              
97             $exception->was_array;
98              
99             True if the node prior to the exception being thrown was an array reference.
100              
101             =head2 was_ending
102              
103             $exception->was_ending;
104              
105             True if the node prior to the exception being thrown was the end of the
106             structure.
107              
108             =head2 was_hash
109              
110             $exception->was_hash;
111              
112             True is the node prior to the exception being thrown was a hash reference.
113              
114             =head2 was_match
115              
116             $exception->was_match;
117              
118             True is the node prior to the exception being thrown had corresponding data.
119              
120             =encoding utf8
121              
122             =head1 AUTHOR
123              
124             Al Newkirk <anewkirk@ana.io>
125              
126             =head1 COPYRIGHT AND LICENSE
127              
128             This software is copyright (c) 2014 by Al Newkirk.
129              
130             This is free software; you can redistribute it and/or modify it under
131             the same terms as the Perl 5 programming language system itself.
132              
133             =cut