| Store | Cart

RE: pop @INC (".")

From: Jan Dubois <j...@activestate.com>
Thu, 8 Mar 2012 23:24:27 -0800
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 sitecustomize.pl, but it means
it will not be in effect if sitecustomize.pl processing is suppressed:

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

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. :)

Cheers,
-Jan

Recent Messages in this Thread
Todd Rinaldo Mar 08, 2012 07:38 pm
David Golden Mar 08, 2012 08:10 pm
Todd Rinaldo Mar 08, 2012 08:20 pm
David Golden Mar 08, 2012 08:45 pm
Jan Dubois Mar 08, 2012 08:58 pm
Todd Rinaldo Mar 08, 2012 10:37 pm
Reini Urban Mar 08, 2012 11:06 pm
H.Merijn Brand Mar 09, 2012 06:56 am
Todd Rinaldo Mar 09, 2012 07:16 am
Tom Christiansen Mar 09, 2012 01:18 pm
Niko Tyni Mar 09, 2012 04:44 pm
Jesse Luehrs Mar 08, 2012 11:16 pm
Steffen Schwigon Mar 12, 2012 01:15 pm
Offer Kaye Mar 08, 2012 08:10 pm
Abigail Mar 08, 2012 10:57 pm
David Golden Mar 08, 2012 10:58 pm
Todd Rinaldo Mar 08, 2012 11:08 pm
H.Merijn Brand Mar 09, 2012 06:47 am
Todd Rinaldo Mar 09, 2012 06:58 am
Jan Dubois Mar 09, 2012 07:24 am
Tom Christiansen Mar 09, 2012 12:24 am
Jan Dubois Mar 09, 2012 12:54 am
Tom Christiansen Mar 09, 2012 02:02 am
Todd Rinaldo Mar 09, 2012 06:59 am
demerphq Mar 09, 2012 07:27 am
Aristotle Pagaltzis Mar 09, 2012 09:33 am
Todd Rinaldo Mar 09, 2012 11:35 am
David Golden Mar 09, 2012 11:57 am
Paul Johnson Mar 09, 2012 12:25 pm
Kent Fredric Mar 09, 2012 01:09 pm
Paul Johnson Mar 09, 2012 02:26 pm
Konovalov, Vadim (Vadim)** CTR ** Mar 11, 2012 06:04 am
Messages in this thread

Previous post: Re: pop @INC (".")
Next post: Re: pop @INC (".")