File Coverage

blib/lib/Data/Seek/Exception/RootUnknown.pm
Criterion Covered Total %
statement 12 21 57.1
branch n/a
condition 0 2 0.0
subroutine 4 5 80.0
pod n/a
total 16 28 57.1


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