blib/lib/HTML/Object/Exception.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 33 Podpod 0.0% 0 / 19 totaltotal 0.0% 0 / 111 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
columnNumber
2.0
colno
2.0
CRAP 2.0
1 ##----------------------------------------------------------------------------
2 ## HTML Object - ~/lib/HTML/Object/Exception.pm
3 ## Version v0.2.0
4 ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2021/11/27
7 ## Modified 2022/09/18
8 ## All rights reserved
9 ##
10 ##
11 ## This program is free software; you can redistribute it and/or modify it
12 ## under the same terms as Perl itself.
13 ##----------------------------------------------------------------------------
14 package HTML::Object::Exception;
15 BEGIN
16 {
17 use strict;
18 use warnings;
19 warnings::register_categories( 'HTML::Object' );
20 use parent qw( Module::Generic::Exception );
21 use vars qw( $VERSION );
22 our $VERSION = 'v0.2.0';
23 };
24  
25 use strict;
26 use warnings;
27  
28 sub columnNumber { return( shift->_set_get_number( 'column', @_ ) ); }
29  
30 sub colno { return( shift->columnNumber( @_ ) ); }
31  
32 sub fileName { return( shift->file( @_ ) ); }
33  
34 sub filename { return( shift->file( @_ ) ); }
35  
36 sub lineNumber { return( shift->line( @_ ) ); }
37  
38 sub lineno { return( shift->line( @_ ) ); }
39  
40 sub name { return( ref( $_[0] ) || $_[0] ); }
41  
42 sub stack { return( shift->trace ); }
43  
44 sub toLocalString { return( shift->as_string ); }
45  
46 sub toString { return( shift->as_string ); }
47  
48 {
49 package
50 HTML::Object::HierarchyRequestError;
51 BEGIN
52 {
53 use parent -norequire, qw( HTML::Object::Exception );
54 };
55
56 package HTML::Object::IndexSizeError;
57 BEGIN
58 {
59 use parent -norequire, qw( HTML::Object::Exception );
60 };
61
62 package
63 HTML::Object::InvalidCharacterError;
64 BEGIN
65 {
66 use parent -norequire, qw( HTML::Object::Exception );
67 };
68
69 package
70 HTML::Object::InvalidStateError;
71 BEGIN
72 {
73 use parent -norequire, qw( HTML::Object::Exception );
74 };
75
76 package HTML::Object::MediaError;
77 BEGIN
78 {
79 use parent -norequire, qw( HTML::Object::Exception );
80 };
81
82 package HTML::Object::NotFoundError;
83 BEGIN
84 {
85 use parent -norequire, qw( HTML::Object::Exception );
86 };
87
88 package
89 HTML::Object::SyntaxError;
90 BEGIN
91 {
92 use parent -norequire, qw( HTML::Object::Exception );
93 };
94
95 package
96 HTML::Object::TypeError;
97 BEGIN
98 {
99 use parent -norequire, qw( HTML::Object::Exception );
100 };
101 }
102  
103 1;
104 # NOTE: POD
105 __END__
106  
107 =encoding utf-8
108  
109 =head1 NAME
110  
111 HTML::Object::Exception - HTML Object
112  
113 =head1 SYNOPSIS
114  
115 use HTML::Object::Exception;
116 my $this = HTML::Object::Exception->new ||
117 die( HTML::Object::Exception->error, "\n" );
118  
119 =head1 VERSION
120  
121 v0.2.0
122  
123 =head1 DESCRIPTION
124  
125 This class inherits all its features and methods from L<Module::Generic::Exception>, and implements the following additional methods:
126  
127 =head1 METHODS
128  
129 =head2 colno
130  
131 An alias for L</columnNumber>
132  
133 =head2 columnNumber
134  
135 Returns the column number, which usually returns C<undef>, because this is not set.
136  
137 =head2 fileName
138  
139 The file name where the error occurred. This is an alias for L<Module::Generic::Exception/file>
140  
141 =head2 filename
142  
143 An alias for L</fileName>
144  
145 =head2 lineno
146  
147 =head2 lineNumber
148  
149 The line number where the error occurred. This is an alias for L<Module::Generic::Exception/line>
150  
151 =head2 name
152  
153 Returns the class name. For example: C<HTML::Object::Exception>
154  
155 =head2 stack
156  
157 Returns the stack trace object. This is an alias for L<Module::Generic::Exception/trace>
158  
159 =head2 toLocalString
160  
161 This is an alias for L<Module::Generic::Exception/as_string>
162  
163 =head2 toString
164  
165 This is an alias for L<Module::Generic::Exception/as_string>
166  
167 =head2 OTHER EXCEPTION CLASSES
168  
169 This module also implements the following exception classes used predominantly by L<HTML::Object::DOM>
170  
171 =over 4
172  
173 =item HTML::Object::ErrorEvent
174  
175 The L<HTML::Object::ErrorEvent> object represents an error triggered and captured by a global error in the L<HTML::Object::DOM::Document> object.
176  
177 It is used by properties like L<HTML::Object::DOM::Document/onabort> or L<HTML::Object::DOM::Document/onerror>
178  
179 See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent>
180  
181 =item HTML::Object::HierarchyRequestError
182  
183 The C<HTML::Object::HierarchyRequestError> object represents an error when the node tree hierarchy is not correct.
184  
185 =item HTML::Object::IndexSizeError
186  
187 The C<HTML::Object::IndexSizeError> object representations an error that occurs when an index is not in the allowed range.
188  
189 For example, in L<HTML::Object::DOM::CharacterData/substringData>
190  
191 =item HTML::Object::InvalidCharacterError
192  
193 The C<HTML::Object::InvalidCharacterError> object represents an error when a given named parameter contains one or more characters which are not valid.
194  
195 =item HTML::Object::InvalidStateError
196  
197 The C<HTML::Object::InvalidStateError> object represents an error when there is in an invalid state.
198  
199 =item HTML::Object::MediaError
200  
201 The C<HTML::Object::MediaError> object represents a L<HTML::Object::DOM::Element::Media> error.
202  
203 =item HTML::Object::NotFoundError
204  
205 The C<HTML::Object::NotFoundError> object represents an error when the object cannot be found here.
206  
207 =item HTML::Object::SyntaxError
208  
209 The C<HTML::Object::SyntaxError> object represents an error when trying to interpret syntactically invalid code.
210  
211 =item HTML::Object::TypeError
212  
213 The C<HTML::Object::TypeError> object represents an error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type.
214  
215 =back
216  
217 =head1 AUTHOR
218  
219 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
220  
221 =head1 SEE ALSO
222  
223 L<HTML::Object::HierarchyRequestError>, L<Module::Generic::Exception>, L<Module::Generic/error>
224  
225 L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/API/DOMException>
226  
227 L<HTML::Object>, L<HTML::Object::Attribute>, L<HTML::Object::Boolean>, L<HTML::Object::Closing>, L<HTML::Object::Collection>, L<HTML::Object::Comment>, L<HTML::Object::Declaration>, L<HTML::Object::Document>, L<HTML::Object::Element>, L<HTML::Object::Exception>, L<HTML::Object::Literal>, L<HTML::Object::Number>, L<HTML::Object::Root>, L<HTML::Object::Space>, L<HTML::Object::Text>, L<HTML::Object::XQuery>
228  
229 =head1 COPYRIGHT & LICENSE
230  
231 Copyright(c) 2021 DEGUEST Pte. Ltd.
232  
233 All rights reserved
234 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
235  
236 =cut