Finding what's been added to @INC
Christian Karg
christian at karg.org
Tue Jul 15 21:03:50 BST 2008
How about brute force (and ugly at that):
my @orig; for (reverse `perl -V`) { m/INC/ and last; s/\s+//g; push
@orig, @_ };
Presto, perl -V paths in @orig :)
ttfn,
Christian
On 15 Jul 2008, at 20:34, Simon Wistow wrote:
> I'd like to be able to walk @INC trying to find everything that's been
> added above and beyond what you'd see from perl -V.
>
> I can't seem to find anything in %Config that's got the information in
> so I'm wondering if I can do something clever with a coderef in %
> INC or
> something. My current best guess is
>
> my %libs = map { $_ => 1 } @INC;
> delete $libs{$_} for @lib::ORIG_INC;
> print join("\n", keys %libs)."\n";
>
> but that doesn't count stuff that was passed in on the command line -
> i.e it will print 'lib' if I have a
>
> use lib qw(lib);
>
> but not if I do
>
> perl -Ilib
>
> unfortunately I can't seem to find anything in perlvar that will
> tell me
> what command line options Perl was invoked with. Then I also have to
> deal with things like -Mblib
>
> Anybody got any ideas?
>
> Simon
>
>
>
More information about the london.pm
mailing list