Home: Perl Programming Help: Intermediate:
get lib full path



yorams70
New User

Oct 18, 2011, 4:20 AM


Views: 3645
get lib full path

Hello.
I have a Perl script that uses a certain lib that someone in my work wrote.

Code
use blabla ;


I am not sure where is the copy of blabla.pm that this script uses.

I want to print the full path of the lib that is used.
Is there a variable that stores the full path?

Thanks.


wickedxter
User

Oct 18, 2011, 9:56 AM


Views: 3635
Re: [yorams70] get lib full path

the directories perl uses to search for modules is keept in the %INC array. You can print that and take a look their. You also might be able to search from the base folder for the module.

if no help their might have to search the whole drive for it b/c if the module uses the ' lib ' module it can be anywhere outside the normal lib and site folders.

edit: opps sry wrong type should of been % rather then @ ....


(This post was edited by wickedxter on Oct 18, 2011, 12:29 PM)


yorams70
New User

Oct 18, 2011, 10:27 AM


Views: 3633
Re: [wickedxter] get lib full path

Thanks,
I found my answer - that is %INC - at
http://perl.apache.org/docs/general/perl_reference/perl_reference.html#The__INC_hash


Code
  % cd /tmp 
% perl -e 'BEGIN{unshift @INC, "/tmp"} use test; \
print map {"$_ => $INC{$_}\n"} keys %INC'

test.pm => /tmp/test.pm