Finding what's been added to @INC
Matt Lawrence
matt.lawrence at virgin.net
Wed Jul 16 09:33:15 BST 2008
Paul Johnson wrote:
> On Tue, Jul 15, 2008 at 09:03:30PM +0100, Simon Wistow wrote:
>
>
>> 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};
>>
> On that note, don't forget about PERLLIB, PERL5OPT and, if you are
> feeling suitable paranoid, PERL5DB. Oh, and sitecustomize.pl. And do
> you care about -Duserelocatableinc? There are probably other ways to do
> nasty things too ...
>
local %ENV removes everything from the local environment, (at least on
5.8.7) so those would have already been stripped. The delete is
misleading there, if you want to remove only particular parts of the
environment, do:
local %ENV = %ENV;
delete @ENV{qw( PERL5LIB PERLLIB PERL5OPT )};
or even:
delete @ENV{ grep { /^PERL/ } keys %ENV };
I suspect that it's OK to run with an empty environment anyway, so
there's no need for the delete at all.
Matt
More information about the london.pm
mailing list