/usr/share/perl5/Text/MicroMason/ParseInfo.pm is in libtext-micromason-perl 2.16-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 | package Text::MicroMason::ParseInfo;
use strict;
use Carp;
######################################################################
# Each time we compile a new template, make sure we create a private clone of
# the MicroMason object and store some local information in a "parse_info" hash.
# ($self, $src_type, $src_data) = $self->prepare($src_type, $src_data, %options)
sub prepare {
my $self = shift;
$self->NEXT('prepare', @_, parse_info => {})
}
######################################################################
# When compiling a template, we first lex() the source code into tokens, then
# we assemble() it into a Perl subroutine. Mixins can hook into this sequence
# to fiddle around with the template while it's still in a "chunked" format.
# In this case we just store information about tokens in our private hash.
# $perl_code = $mason->assemble( @tokens );
sub assemble {
my $self = shift;
my @tokens = @_;
my $parse_info = ( $self->{parse_info} ||= {} );
for ( my $position = 0; $position <= $#tokens; $position += 2 ) {
my ( $token_type, $token_value ) = @tokens[$position, $position + 1];
if ( $token_type eq 'args' ) {
while ( $token_value =~ /^\s*([\$\@\%])(\w+)(?:\s*=>\s*([^\r\n]+))?/g ) {
push $parse_info->{'args'}->{ "$1$2" } = $3
}
} elsif ( $token_type eq 'file' ) {
push @{ $parse_info->{'file'} }, $token_value;
} elsif ( $token_type eq 'doc' ) {
push @{ $parse_info->{'doc'} }, $token_value;
}
}
$self->NEXT('assemble', @tokens );
}
######################################################################
1;
######################################################################
|