1HTML::Lint::Error(3) User Contributed Perl Documentation HTML::Lint::Error(3)
2
3
4
6 HTML::Lint::Error - Error object for the Lint functionality
7
9 See HTML::Lint for all the gory details.
10
12 None. It's all object-based.
13
15 Almost everything is an accessor.
16
18 Each error has a type. Note that these roughly, but not exactly, go
19 from most severe to least severe.
20
21 • "STRUCTURE"
22
23 For problems that relate to the structural validity of the code.
24 Examples: Unclosed <TABLE> tags, incorrect values for attributes,
25 and repeated attributes.
26
27 • "HELPER"
28
29 Helpers are notes that will help you with your HTML, or that will
30 help the browser render the code better or faster. Example:
31 Missing HEIGHT and WIDTH attributes in an IMG tag.
32
33 • "FLUFF"
34
35 Fluff is for items that don't hurt your page, but don't help it
36 either. This is usually something like an unknown attribute on a
37 tag.
38
39 new()
40 Create an object. It's not very exciting.
41
42 is_type( $type1 [, $type2 ] )
43 Tells if any of $type1, $type2... match the error's type. Returns the
44 type that matched.
45
46 if ( $err->is_type( HTML::Lint::Error::STRUCTURE ) ) {....
47
48 where()
49 Returns a formatted string that describes where in the file the error
50 has occurred.
51
52 For example,
53
54 (14:23)
55
56 for line 14, column 23.
57
58 The terrible thing about this function is that it's both a plain ol'
59 formatting function as in
60
61 my $str = where( 14, 23 );
62
63 AND it's an object method, as in:
64
65 my $str = $error->where();
66
67 I don't know what I was thinking when I set it up this way, but it's
68 bad practice.
69
70 as_string()
71 Returns a nicely-formatted string for printing out to stdout or some
72 similar user thing.
73
74 file()
75 Returns the filename of the error, as set by the caller.
76
77 line()
78 Returns the line number of the error.
79
80 column()
81 Returns the column number, starting from 0
82
83 errcode()
84 Returns the HTML::Lint error code. Don't rely on this, because it will
85 probably go away.
86
87 errtext()
88 Descriptive text of the error
89
90 type()
91 Type of the error
92
94 Each possible error in HTML::Lint has a code. These codes are used to
95 identify each error for when you need to turn off error checking for a
96 specific error.
97
98 api-parse-not-called
99 You called the errors() method before calling parse() and eof().
100
101 api-eof-not-called
102 You called the errors() method before calling eof().
103
104 config-unknown-directive
105 Unknown directive "DIRECTIVE"
106
107 You specified a directive in a comment for HTML::Lint that it didn't
108 recognize.
109
110 config-unknown-value
111 Unknown value "VALUE" for DIRECTIVE directive
112
113 Directive values can only be "on", "off", "yes", "no", "true", "false",
114 "0" and "1".
115
116 elem-unknown
117 HTML::Lint doesn't know recognize the tag.
118
119 elem-unopened
120 "</tag>" with no opening "<tag>".
121
122 elem-unclosed
123 "<tag>" at WHERE is never closed.
124
125 elem-empty-but-closed
126 "<tag>" is not a container -- "</tag>" is not allowed.
127
128 elem-img-alt-missing
129 "<img src="FILENAME.PNG">" does not have ALT text defined.
130
131 elem-img-sizes-missing
132 "<img src="FILENAME.PNG">" tag has no HEIGHT and WIDTH attributes.
133
134 elem-nonrepeatable
135 "<tag>" is not repeatable, but already appeared at WHERE.
136
137 doc-tag-required
138 "<tag>" tag is required.
139
140 attr-repeated
141 ATTR attribute in "<tag>" is repeated.
142
143 attr-unknown
144 Unknown attribute "ATTR" for tag "<tag>".
145
146 text-unclosed-entity
147 Entity ENTITY is missing its closing semicolon
148
149 text-unknown-entity
150 Entity ENTITY is unknown
151
152 text-use-entity
153 Character "CHAR" should be written as ENTITY
154
156 Copyright 2005-2018 Andy Lester.
157
158 This program is free software; you can redistribute it and/or modify it
159 under the terms of the Artistic License v2.0.
160
161 http://www.opensource.org/licenses/Artistic-2.0
162
163 Please note that these modules are not products of or supported by the
164 employers of the various contributors to the code.
165
167 Andy Lester, "andy at petdance.com"
168
169
170
171perl v5.38.0 2023-07-20 HTML::Lint::Error(3)