Finding what's been added to @INC

Simon Wistow simon at thegestalt.org
Tue Jul 15 20:34:06 BST 2008


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