/usr/share/perl5/graphincludes/extractor/perl.pm is in libdeps-perl 0.13-2.
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 | # This file is part of the DEPS/graph-includes package
#
# (c) 2005,2006 Yann Dirson <ydirson@altern.org>
# Distributed under version 2 of the GNU GPL.
package graphincludes::extractor::perl;
use strict;
use warnings;
use File::Spec::Functions qw(catfile);
use base qw(graphincludes::extractor);
use graphincludes::params;
# This is only a preliminary extractor for perl dependencies. It should
# correctly catch:
# - use <bareword>
# - require <bareword>
# - require "<file>"
# - require '<file>'
# - use base qw(<single-class>)
#
# It misses:
# - all other "use base <whatever>", including qw(several classes)
# - direct uses of "import base"
# - require <expr>
# - do <expr>
# - statements not the 1st of a line
#
# It will be confused by "require <expr>", trying to locate a file
# with a name corresponding to the un-eval'ed expression.
sub get_default_sysincludes {
# since this program does mess wih @INC, we must ask another perl
# what it thinks @INC is
open INC, 'perl -e \'print join "\n", @INC\' |';
my @incs;
while (<INC>) {
chomp;
push @incs, $_;
}
close INC;
return @incs;
}
sub pattern { '\.(pm|pl)$' }
sub getdeps {
my $self = shift;
my ($graph) = @_;
@ARGV = map {$_->{LABEL}} $graph->get_nodes();
while (<>) {
my $dstfile;
if (m/^\s*require\s*["'](\S+)["']/) {
print STDERR "Found quoted require: $_" if $graphincludes::params::debug;
$dstfile = $self->locatefile ($1, '.', @graphincludes::params::inclpath);
} elsif (m/^\s*use\s+base\s+qw\(\s*([\w:]+)\s*\)/) {
print STDERR "Found use_base: $_" if $graphincludes::params::debug;
$dstfile = $1;
$dstfile =~ s|::|/|g;
$dstfile = $self->locatefile ($dstfile . '.pm', '.', @graphincludes::params::inclpath);
} elsif (m/^\s*(?:use|require)\s*([\w:]+)/) {
print STDERR "Found use/require: $_" if $graphincludes::params::debug;
$dstfile = $1;
$dstfile =~ s|::|/|g;
$dstfile = $self->locatefile ($dstfile . '.pm', '.', @graphincludes::params::inclpath);
} else {
next;
}
if (defined $dstfile) {
$graph->record_edge ($ARGV, $dstfile);
} else {
$self->record_missed_dep ($ARGV, catfile (split(/::/, $1)) . '.pm');
}
}
}
1;
|