From b6bb702d72062c03ece8c1bf8f45c277973da7f5 Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Tue, 6 Dec 2005 21:19:54 +0000 Subject: [PATCH] Added get_default_sysincludes() support for perl --- NEWS | 3 +++ lib/graphincludes/extractor/perl.pm | 21 ++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9dc8a3f..f2216a5 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,9 @@ Version 0.11 - UNRELEASED * The C extractor now looks in for system headers in /usr/include by default. + * The Perl extractor uses the default @INC value to locate system + headers. + Changes for the class writer: * Per-language extractors can now declare a default system-include diff --git a/lib/graphincludes/extractor/perl.pm b/lib/graphincludes/extractor/perl.pm index 1eddfd1..4d0b77e 100644 --- a/lib/graphincludes/extractor/perl.pm +++ b/lib/graphincludes/extractor/perl.pm @@ -7,6 +7,8 @@ package graphincludes::extractor::perl; use strict; use warnings; +use File::Spec::Functions qw(catfile); + use base qw(graphincludes::extractor); use graphincludes::params; @@ -29,6 +31,23 @@ use graphincludes::params; # It will be confused by "require ", 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 () { + chomp; + push @incs, $_; + } + close INC; + + use Data::Dumper; + print STDERR Dumper \@incs; + + return @incs; +} + sub pattern { '\.(pm|pl)$' } sub getdeps { @@ -61,7 +80,7 @@ sub getdeps { if (defined $dstfile) { $self->record_dep (\%deps, $ARGV, $dstfile); } else { - $self->record_missed_dep ($ARGV, $1); + $self->record_missed_dep ($ARGV, catfile (split(/::/, $1)) . '.pm'); } } return \%deps; -- 2.11.4.GIT