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

New User

Oct 18, 2011, 4:20 AM

Views: 3613
get lib full path

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

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?



Oct 18, 2011, 9:56 AM

Views: 3603
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)

New User

Oct 18, 2011, 10:27 AM

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

I found my answer - that is %INC - at

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

test.pm => /tmp/test.pm