This file is indexed.

/usr/share/perl5/PlSense/ModuleSrcUpdater.pm is in plsense 0.3.1-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
package PlSense::ModuleSrcUpdater;

use strict;
use warnings;
use Class::Std;
use PPI::Document;
use PlSense::Logger;
use PlSense::Util;
use PlSense::Symbol::Module;
{
    sub update_or_create_modules {
        my ($self, $filepath, $projectnm) = @_;
        my %foundmdl_is;

        if ( ! -f $filepath ) {
            logger->error("Not exist file[$filepath]");
            return ();
        }
        my @attr = stat $filepath;
        my $lastmodified = $attr[9];

        my $currmdl = mdlkeeper->get_module("main", $filepath);
        if ( ! $currmdl ) {
            $currmdl = PlSense::Symbol::Module->new({ name => "main",
                                                      filepath => $filepath,
                                                      projectnm => $projectnm,
                                                      lastmodified => $lastmodified,
                                                      linenumber => 1,
                                                      colnumber => 1, });
            logger->notice("New module [".$currmdl->get_name."] in [".$currmdl->get_filepath."] belong [".$currmdl->get_projectnm."]");
            mdlkeeper->store_module($currmdl);
        }
        $currmdl->reset_all($lastmodified);
        $foundmdl_is{$currmdl->get_name} = $currmdl;

        logger->notice("Start get PPI::Document of module from [".$filepath."]");
        my $doc = PPI::Document->new( $filepath, readonly => 1 );
        if ( ! $doc ) {
            logger->warn("Can't get PPI::Document from [$filepath]");
            return ($currmdl);
        }

        my $mainmdl = $currmdl;
        TOPSTMT:
        foreach my $e ( $doc->children ) {

            # Get current package
            if ( $e->isa("PPI::Statement::Package") ) {

                my $mdlnm = "".$e->namespace."";
                if ( $mdlnm eq "main" ) {
                    $currmdl = $mainmdl;
                }
                elsif ( ! exists $foundmdl_is{$mdlnm} ) {
                    my $mdl = mdlkeeper->get_module($mdlnm);
                    if ( ! $mdl ) {
                        $mdl = PlSense::Symbol::Module->new({ name => $mdlnm,
                                                              filepath => $filepath,
                                                              projectnm => $projectnm,
                                                              lastmodified => $lastmodified });
                        logger->notice("New module [".$mdl->get_name."] in [".$mdl->get_filepath."] belong [".$mdl->get_projectnm."]");
                        mdlkeeper->store_module($mdl);
                    }
                    $mdl->reset_all($lastmodified);
                    $foundmdl_is{$mdlnm} = $mdl;
                    logger->debug("Found bundle module of [".$mainmdl->get_name."] : ".$mdl->get_name);
                    $mainmdl->push_bundlemdl($mdl);
                }
                $currmdl = $foundmdl_is{$mdlnm};
                $currmdl->set_linenumber($e->line_number);
                $currmdl->set_colnumber($e->column_number);

            }

            elsif ( $currmdl && $e->isa("PPI::Element") ) {
                my $currdoc = $currmdl->get_source;
                if ( ! $currdoc ) {
                    $currdoc = PPI::Document->new;
                    $currmdl->set_source($currdoc);
                }
                if ( ! $currdoc->add_element($e->clone) ) {
                    logger->error("Failed add source to ".$currmdl->get_name);
                }
            }

        }

        return values %foundmdl_is;
    }
}

1;

__END__