Finding what's been added to @INC

Simon Wistow simon at
Tue Jul 15 21:03:30 BST 2008

On Tue, Jul 15, 2008 at 08:34:06PM +0100, me said:
> Anybody got any ideas?

So one solution, suggested by Jess was to exec another Perl and diff 
their @INCs. We came up with

my %tmp = map { $_ => 1 } split ':', do
    local %ENV && delete $ENV{PERL5LIB};
    `$^X -e 'print join(":", \@INC)'`;
my @LOCALINC = grep { !$tmp{$_} } @INC;
print join("\n", @LOCALINC)."\n";

Running that on its own

% perl inctest

% perl -Mlib=lib inctest

% perl -Iinc inctest

% perl -Mblib inctest

% PERL5LIB=~/perllib inctest

I keep thinking that there ought to be a better way though.

More information about the mailing list