This file is indexed.

/usr/share/perl5/Petal/Hash/String.pm is in libpetal-perl 2.20-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
# ------------------------------------------------------------------
# Petal::Hash::String - Interpolates variables with other strings
# ------------------------------------------------------------------
# Author: Jean-Michel Hiver
# This module is redistributed under the same license as Perl
# itself.
# ------------------------------------------------------------------
package Petal::Hash::String;
use strict;
use warnings;
use Carp;


our $VARIABLE_RE_SIMPLE   = qq |\\\$[A-Za-z_][A-Za-z0-9_\\.:\/]+|;
our $VARIABLE_RE_BRACKETS = qq |\\\$(?<!\\\\)\\{.*?(?<!\\\\)\\}|;
our $TOKEN_RE             = "(?:$VARIABLE_RE_SIMPLE|$VARIABLE_RE_BRACKETS)";


sub process
{
    my $self = shift;
    my $hash = shift;
    my $argument = shift;

    $Petal::TranslationService && do {
        $argument = eval { $Petal::TranslationService->maketext ($argument) } || $argument;
        $@ and warn $@;
    };
    
    my $tokens = $self->_tokenize (\$argument);
    my @res = map {
	($_ =~ /$TOKEN_RE/gsm) ?
	    do {
		s/^\$//;
		s/^\{//;
		s/\}$//;
		$hash->fetch ($_);
	    } :
	    do {
		s/\\(.)/$1/gsm;
		$_;
	    };
    } @{$tokens};
    
    return join '', map { defined $_ ? $_ : () } @res;
}


# $class->_tokenize ($data_ref);
# ------------------------------
#   Returns the data to process as a list of tokens:
#   ( 'some text', '<% a_tag %>', 'some more text', '<% end-a_tag %>' etc.
sub _tokenize
{
    my $self = shift;
    my $data_ref = shift;
    
    my @tokens = $$data_ref =~ /($TOKEN_RE)/gs;
    my @split  = split /$TOKEN_RE/s, $$data_ref;
    my $tokens = [];
    while (@split)
    {
        push @{$tokens}, shift (@split);
        push @{$tokens}, shift (@tokens) if (@tokens);
    }
    push @{$tokens}, (@tokens);
    return $tokens;
}


1;


__END__