This file is indexed.

/usr/lib/slic3r/Slic3r/GCode/PlaceholderParser.pm is in slic3r 1.2.9+dfsg-9~deb9u1.

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
package Slic3r::GCode::PlaceholderParser;
use strict;
use warnings;

sub new {
    # TODO: move this code to C++ constructor, remove this method
    my ($class) = @_;
    
    my $self = $class->_new;
    $self->apply_env_variables;
    return $self;
}

sub apply_env_variables {
    my ($self) = @_;
    $self->_single_set($_, $ENV{$_}) for grep /^SLIC3R_/, keys %ENV;
}

sub process {
    my ($self, $string, $extra) = @_;
    
    # extra variables have priority over the stored ones
    if ($extra) {
        my $regex = join '|', keys %$extra;
        $string =~ s/\[($regex)\]/$extra->{$1}/eg;
    }
    {
        my $regex = join '|', @{$self->_single_keys};
        $string =~ s/\[($regex)\]/$self->_single_get("$1")/eg;
    }
    {
        my $regex = join '|', @{$self->_multiple_keys};
        $string =~ s/\[($regex)\]/$self->_multiple_get("$1")/egx;
        
        # unhandled indices are populated using the first value
        $string =~ s/\[($regex)_\d+\]/$self->_multiple_get("$1")/egx;
    }
    
    return $string;
}

1;