This file is indexed.

/usr/share/perl5/HTML/Lint/Error.pm is in libhtml-lint-perl 2.20+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
package HTML::Lint::Error;

use warnings;
use strict;

use base 'Exporter';

our @EXPORT = ();
our @EXPORT_OK = qw( STRUCTURE HELPER FLUFF );
our %EXPORT_TAGS = ( types => [@EXPORT_OK] );

our %errors;

=head1 NAME

HTML::Lint::Error - Error object for the Lint functionality

=head1 SYNOPSIS

See L<HTML::Lint> for all the gory details.

=head1 EXPORTS

None.  It's all object-based.

=head1 METHODS

Almost everything is an accessor.

=head1 Error types: C<STRUCTURE>, C<HELPER>, C<FLUFF>

Each error has a type.  Note that these roughly, but not exactly, go
from most severe to least severe.

=over 4

=item * C<STRUCTURE>

For problems that relate to the structural validity of the code.
Examples: Unclosed <TABLE> tags, incorrect values for attributes, and
repeated attributes.

=item * C<HELPER>

Helpers are notes that will help you with your HTML, or that will help
the browser render the code better or faster.  Example: Missing HEIGHT
and WIDTH attributes in an IMG tag.

=item * C<FLUFF>

Fluff is for items that don't hurt your page, but don't help it either.
This is usually something like an unknown attribute on a tag.

=back

=cut

use constant CONFIG     => 1;
use constant STRUCTURE  => 2;
use constant HELPER     => 3;
use constant FLUFF      => 4;

=head2 new()

Create an object.  It's not very exciting.

=cut

sub new {
    my $class    = shift;

    my $file     = shift;
    my $line     = shift;
    my $column   = shift;
    my $errcode  = shift;
    my @errparms = @_;

    # Add an element that says what tag caused the error (B, TR, etc)
    # so that we can match 'em up down the road.
    my $self  = {
        _file    => $file,
        _line    => $line,
        _column  => $column,
        _errcode => $errcode,
        _errtext => undef,
        _type    => undef,
    };

    bless $self, $class;

    $self->_expand_error( $errcode, @errparms );

    return $self;
}

sub _expand_error {
    my $self = shift;

    my $errcode = shift;

    my $specs = $errors{$errcode};
    my $str;
    if ( $specs ) {
        ($str, $self->{_type}) = @{$specs};
    }
    else {
        $str = "Unknown code: $errcode";
    }

    while ( @_ ) {
        my $var = shift;
        my $val = shift;
        $str =~ s/\$\{$var\}/$val/g;
    }

    $self->{_errtext} = $str;

    return;
}

=head2 is_type( $type1 [, $type2 ] )

Tells if any of I<$type1>, I<$type2>... match the error's type.
Returns the type that matched.

    if ( $err->is_type( HTML::Lint::Error::STRUCTURE ) ) {....

=cut

sub is_type {
    my $self = shift;

    for my $matcher ( @_ ) {
        return $matcher if $matcher eq $self->type;
    }

    return;
}

=head2 where()

Returns a formatted string that describes where in the file the
error has occurred.

For example,

    (14:23)

for line 14, column 23.

The terrible thing about this function is that it's both a plain
ol' formatting function as in

    my $str = where( 14, 23 );

AND it's an object method, as in:

    my $str = $error->where();

I don't know what I was thinking when I set it up this way, but
it's bad practice.

=cut

sub where {
    my $line;
    my $col;

    if ( not ref $_[0] ) {
        $line = shift;
        $col = shift;
    } else {
        my $self = shift;
        $line = $self->line;
        $col = $self->column;
    }
    $col ||= 0;
    return sprintf( '(%s:%s)', $line, $col + 1 );
}

=head2 as_string()

Returns a nicely-formatted string for printing out to stdout or some similar user thing.

=cut

sub as_string {
    my $self = shift;

    return sprintf( '%s %s %s', $self->file, $self->where, $self->errtext );
}

=head2 file()

Returns the filename of the error, as set by the caller.

=head2 line()

Returns the line number of the error.

=head2 column()

Returns the column number, starting from 0

=head2 errcode()

Returns the HTML::Lint error code.  Don't rely on this, because it will probably go away.

=head2 errtext()

Descriptive text of the error

=head2 type()

Type of the error

=cut

sub file        { my $self = shift; return $self->{_file}    || '' }
sub line        { my $self = shift; return $self->{_line}    || '' }
sub column      { my $self = shift; return $self->{_column}  || '' }
sub errcode     { my $self = shift; return $self->{_errcode} || '' }
sub errtext     { my $self = shift; return $self->{_errtext} || '' }
sub type        { my $self = shift; return $self->{_type}    || '' }


=head1 POSSIBLE ERRORS

Each possible error in HTML::Lint has a code.  These codes are used
to identify each error for when you need to turn off error checking
for a specific error.

=cut

%errors = (
    'config-unknown-directive' => ['Unknown directive "${directive}"', CONFIG],
    'config-unknown-value'     => ['Unknown value "${value}" for ${directive} directive', CONFIG],

    'elem-empty-but-closed'    => ['<${tag}> is not a container -- </${tag}> is not allowed', STRUCTURE],
    'elem-img-alt-missing'     => ['<img src="${src}"> does not have ALT text defined', HELPER],
    'elem-img-sizes-missing'   => ['<img src="${src}"> tag has no HEIGHT and WIDTH attributes', HELPER],
    'elem-nonrepeatable'       => ['<${tag}> is not repeatable, but already appeared at ${where}', STRUCTURE],
    'elem-unclosed'            => ['<${tag}> at ${where} is never closed', STRUCTURE],
    'elem-unknown'             => ['Unknown element <${tag}>', STRUCTURE],
    'elem-unopened'            => ['</${tag}> with no opening <${tag}>', STRUCTURE],

    'doc-tag-required'         => ['<${tag}> tag is required', STRUCTURE],

    'attr-repeated'            => ['${attr} attribute in <${tag}> is repeated', STRUCTURE],
    'attr-unknown'             => ['Unknown attribute "${attr}" for tag <${tag}>', FLUFF],

    'text-invalid-entity'      => ['Entity ${entity} is invalid', STRUCTURE],
    'text-unclosed-entity'     => ['Entity ${entity} is missing its closing semicolon', STRUCTURE],
    'text-unknown-entity'      => ['Entity ${entity} is unknown', STRUCTURE],
    'text-use-entity'          => ['Character "${char}" should be written as ${entity}', STRUCTURE],
);

=head2 config-unknown-directive

Unknown directive "DIRECTIVE"

You specified a directive in a comment for HTML::Lint that it didn't recognize.

=head2 config-unknown-value

Unknown value "VALUE" for DIRECTIVE directive

Directive values can only be "on", "off", "yes", "no", "true", "false", "0" and "1".

=head2 elem-unknown

Unknown element E<lt>TAGE<gt>

HTML::Lint doesn't know what a TAG tag is.  These are pulled from HTML::Entities

=head2 elem-unopened

E<lt>/TAGE<gt> with no opening E<lt>TAGE<gt>

=head2 elem-unclosed

E<lt>TAGE<gt> at WHERE is never closed

=head2 elem-empty-but-closed

E<lt>TAGE<gt> is not a container -- E<lt>/TAGE<gt> is not allowed

=head2 elem-img-alt-missing

E<lt>img src="FILENAME.PNG"E<gt> does not have ALT text defined

=head2 elem-img-sizes-missing

E<lt>img src="FILENAME.PNG"E<gt> tag has no HEIGHT and WIDTH attributes

=head2 elem-nonrepeatable

E<lt>TAGE<gt> is not repeatable, but already appeared at WHERE

=head2 doc-tag-required

E<lt>TAGE<gt> tag is required

=head2 attr-repeated

ATTR attribute in E<lt>TAGE<gt> is repeated

=head2 attr-unknown

Unknown attribute "ATTR" for tag E<lt>TAGE<gt>

=head2 text-invalid-entity

Entity ENTITY is invalid

=head2 text-unclosed-entity

Entity ENTITY is missing its closing semicolon

=head2 text-unknown-entity

Entity ENTITY is unknown

=head2 text-use-entity

Character "CHAR" should be written as ENTITY

=head1 COPYRIGHT & LICENSE

Copyright 2005-2012 Andy Lester.

This program is free software; you can redistribute it and/or modify it
under the terms of the Artistic License v2.0.

http://www.opensource.org/licenses/Artistic-2.0

=head1 AUTHOR

Andy Lester, C<andy at petdance.com>

=cut

1; # happy

__DATA__
Errors that haven't been done yet.

#elem-head-only                 <${tag}> can only appear in the <HEAD> element
#elem-non-head-element          <${tag}> cannot appear in the <HEAD> element
#elem-obsolete                  <${tag}> is obsolete
#elem-nested-element            <${tag}> cannot be nested -- one is already opened at ${where}
#elem-wrong-context             Illegal context for <${tag}> -- must appear in <${othertag}> tag.
#elem-heading-in-anchor         <A> should be inside <${tag}>, not <${tag}> inside <A>

#elem-head-missing              No <HEAD> element found
#elem-head-missing-title        No <TITLE> in <HEAD> element
#elem-img-sizes-incorrect       <IMG> tag's HEIGHT and WIDTH attributes are incorrect.  They should be ${correct}.
#attr-missing                   <${tag}> is missing a "${attr}" attribute

#comment-unclosed               Unclosed comment
#comment-markup                 Markup embedded in a comment can confuse some browsers

#text-literal-metacharacter     Metacharacter $char should be represented as "$otherchar"
#text-title-length              The HTML spec recommends that that <TITLE> be no more than 64 characters
#text-markup                    Tag <${tag}> found in the <TITLE>, which will not be rendered properly.

#elem-physical-markup           <${tag}> is physical font markup.  Use logical (such as <${othertag}>) instead.
#elem-leading-whitespace        <${tag}> should not have whitespace between "<" and "${tag}>"
#'must-follow' => [ ENABLED, MC_ERROR, '<$argv[0]> must immediately follow <$argv[1]>', ],
# 'empty-container' => [ ENABLED, MC_WARNING, 'empty container element <$argv[0]>.', ],
# 'directory-index' => [ ENABLED, MC_WARNING, 'directory $argv[0] does not have an index file ($argv[1])', ],
# 'attribute-delimiter' => [ ENABLED, MC_WARNING, 'use of \' for attribute value delimiter is not supported by all browsers (attribute $argv[0] of tag $argv[1])', ],
# 'container-whitespace' => [ DISABLED, MC_WARNING, '$argv[0] whitespace in content of container element $argv[1]', ],
# 'bad-text-context' => [ ENABLED, MC_ERROR, 'illegal context, <$argv[0]>, for text; should be in $argv[1].', ],
# 'attribute-format' => [ ENABLED, MC_ERROR, 'illegal value for $argv[0] attribute of $argv[1] ($argv[2])', ],
# 'quote-attribute-value' => [ ENABLED, MC_ERROR, 'value for attribute $argv[0] ($argv[1]) of element $argv[2] should be quoted (i.e. $argv[0]="$argv[1]")', ],
# 'meta-in-pre' => [ ENABLED, MC_ERROR, 'you should use "$argv[0]" in place of "$argv[1]", even in a PRE element.', ],
#  'implied-element' => [ ENABLED, MC_WARNING, 'saw <$argv[0]> element, but no <$argv[1]> element', ],
#  'button-usemap' => [ ENABLED, MC_ERROR, 'illegal to associate an image map with IMG inside a BUTTON', ],