This file is indexed.

/usr/share/perl5/Text/MicroMason/LineNumbers.pm is in libtext-micromason-perl 2.21-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
package Text::MicroMason::LineNumbers;
use strict;

######################################################################

sub read {
  my ( $self, $src_type, $src_data ) = @_;

  $self->{ last_read_file } = "unrecognized source $src_type";
  $self->{ last_read_line } = 1;

  $self->NEXT( 'read', $src_type, $src_data )
}

sub read_file {
  my ( $self, $file ) = @_;

  $self->{ last_read_file } = $file;

  $self->NEXT( 'read_file', $file )
}

sub read_handle {
  my ( $self, $handle ) = @_;

  my ( $caller_file, $caller_line ) = $self->_get_external_caller();
  $self->{ last_read_file } = "file handle template (compiled at $caller_file line $caller_line)";

  $self->NEXT( 'read_handle', $handle )
}

sub read_text {
  my ( $self, $text ) = @_;

  my ( $caller_file, $caller_line ) = $self->_get_external_caller();
  $self->{ last_read_file } = "text template (compiled at $caller_file line $caller_line)";

  $self->NEXT( 'read_text', $text )
}

sub read_inline {
  my ( $self, $text ) = @_;

  my ( $caller_file, $caller_line ) = $self->_get_external_caller();
  $self->{ last_read_file } = $caller_file;
  $self->{ last_read_line } = $caller_line;

  $self->NEXT( 'read_text', $text )
}

sub _get_external_caller {
	my ( $self ) = @_;
  my ( @caller, $call_level );
  do { @caller = caller( ++ $call_level ) }
      while ( $caller[0] =~ /^Text::MicroMason/ or $self->isa($caller[0]) );
  return ( $caller[1] || $0, $caller[2] );
}

######################################################################

sub lex {
    my $self = shift;
    local $_ = "$_[0]";
    
    my $lexer = $self->can('lex_token') 
        or $self->croak_msg('Unable to lex_token(); must select a syntax mixin');
    
    my $filename = $self->{ last_read_file } || 'unknown source';
    my $linenum = $self->{ last_read_line } || 1;
    my $last_pos = 0;
    
    my @tokens;
    until ( /\G\z/gc ) {
        my @parsed = &$lexer( $self )
            or /\G ( .{0,20} ) /gcxs && die "MicroMason parsing halted at '$1'\n";
        push @tokens, 'line_num' => ( $linenum - 1 ) . qq{ "$filename"};
        push @tokens, @parsed;
        
        # Update the current line number by counting newlines in the text 
        # we've parsed since the last time through the loop.
        my $new_pos = pos($_) || 0;
        $linenum += ( substr($_, $last_pos, $new_pos - $last_pos) =~ tr[\n][] ); 
        $last_pos = $new_pos;
    }
    
    return @tokens;
}

sub assembler_rules {
  my $self = shift;
  (
	  $self->NEXT('assembler_rules', @_),
	  line_num_token => 'perl # line TOKEN',
	)
}

######################################################################

1;

######################################################################


=head1 NAME

Text::MicroMason::LineNumbers - Report errors at correct source code line numbers


=head1 DESCRIPTION

This mixin class associates each token in a template with the line
number on which it was found, and then inserts special comments in the
generated Perl code that preserve that original source file and line
number information.

This should facilitate debugging, by making it easier to match up run-
time errors with the template code that produced them.

To turn this behavior on, just add "-LineNumbers" to your MicroMason
creation call:

  my $mason = Text::MicroMason->new( qw( -LineNumbers ) );


=head2 Public Methods

These methods are called from within the normal flow of MicroMason
functionality, and you do not need to invoke them directly.

=over 4

=item read()

Clears the variables used to store the file name and first line of a
template, so that they can be set by the methods below.

=item read_file()

Saves the source file name before invoking the standard behavior for this method.

  $mason->compile( file => $filename );

=item read_handle()

Saves the caller's file name before invoking the standard behavior for this method.

  $mason->compile( handle => $filename );

=item read_text()

Saves the caller's file name before invoking the standard behavior for this method.

  $mason->compile( text => $filename );

=item read_inline()

This is similar to read_text, except it adjusts the line numbering to
reflect a template that's embdded as a literal text in the Perl code.

  $mason->compile( inline => q{
	  My template text goes here.
  } );

=item lex()

Identical to the lex() method provided by the Base class, except that it
also inserts a stream of line-number-setting comments into the to-be-
compiled Perl code that attempt to re-synchronize the

=item assembler_rules()

Maps the "line_num" token to a perl line number comment.

=back


=head2 Private Methods

=over 4

=item _get_external_caller()

Returns the source file and line number of the first item in the
function call stack that is not a Text::MicroMason package.

=back


=head1 SEE ALSO

For an overview of this templating framework, see L<Text::MicroMason>.

This is a mixin class intended for use with L<Text::MicroMason::Base>.

For distribution, installation, support, copyright and license
information, see L<Text::MicroMason::Docs::ReadMe>.

=cut