develooper Front page | perl.perl5.porters | Postings from March 2012

RE: pop @INC (".")

Thread Previous | Thread Next
Jan Dubois
March 8, 2012 23:24
RE: pop @INC (".")
Message ID:
On Thu, 08 Mar 2012, Todd Rinaldo wrote:
> As best I can tell at the moment, sitecustomize would not do what
> you're describing,

It is certainly possible to do this with, but it means
it will not be in effect if processing is suppressed:

$ head -1 /usr/local/ActivePerl-5.12/site/lib/ 
@INC = grep $_ ne '.', @INC;
$ perl -f -V | tail -5
  Compiled at Feb  9 2011 14:47:05
$ perl -V | tail -5
  Compiled at Feb  9 2011 14:47:05

Note that this will always filter out '.' from anywhere in @INC,
so it would effectively disable -I.

If you don't want that, you could use

pop @INC if $INC[-1] eq '.';

You could even try to use some heuristics, like checking that $ARGV[0]
isn't Makefile.PL and doesn't start with t/ or xt/, and only remove
'.' when those conditions are false.  I would hate having such heuristics
inflicted on me though, so I won't recommend that you do this to others. :)


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About