niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Programming » Perl » modules
most elegant way to find an installed datafile directory
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
Author Message
alexxx.magni@gmail.com
*nix forums beginner


Joined: 22 Mar 2006
Posts: 5

PostPosted: Fri Jul 07, 2006 1:07 pm    Post subject: most elegant way to find an installed datafile directory Reply with quote

I continue on an old topic, on which I received some help
(I cannot find anymore the link to the discussion, sorry):
Quote:
....
I'm beginning to use MakeMaker and have some problems with it: I need
to install some auxiliary data files, and I can't figure out how to tell that to MakeMaker.
e.g. I'd like that my final install would include some data files under /etc/projectname/
so: 1) where do I put them originally? (in lib/etc for example?)
and 2) how do I tell MakeMaker to install them in /etc/projactname ?

then:

Quote:
I correct myself on a point: I just checked that if I put my datafiles
in a directory like projectname/lib/datafiles/... they are all
installed for good, in my computer under /usr/lib/perl5/site_perl/5.8.6/projectname/datafiles/...
This compromise I could accept, but how do I access that install
directory name from my program?

and Rob (Sisyphus) replied:
Quote:
The prefix to that directory will be contained in one of the %Config keys -
I think it's $Config{sitelib}. That being the case, so long as you 'use
Config;' , you can access the directory as
$Config{sitelib}/projectname/datafiles/ .


now: I relocated my perl library from system-wide to local, with:
export PERL5LIB=$PERL5LIB:/home/x/lib/perl/lib/perl5/site_perl/

so now the datafiles that interest me are under
/home/x/lib/perl/lib/perl5/site_perl/5.8.8/projectname/...

unfortunately I see that the %Config hash does not hold this directory.
So: what is the most elegant way to find a datafile directory which has
been installed locally?


thanks!

Alessandro Magni
Back to top
harryfmudd [AT] comcast [
*nix forums addict


Joined: 15 Oct 2005
Posts: 82

PostPosted: Fri Jul 07, 2006 9:07 pm    Post subject: Re: most elegant way to find an installed datafile directory Reply with quote

alexxx.magni@gmail.com wrote:

Quote:
I continue on an old topic, on which I received some help
(I cannot find anymore the link to the discussion, sorry):

....
I'm beginning to use MakeMaker and have some problems with it: I need
to install some auxiliary data files, and I can't figure out how to tell that to MakeMaker.
e.g. I'd like that my final install would include some data files under /etc/projectname/
so: 1) where do I put them originally? (in lib/etc for example?)
and 2) how do I tell MakeMaker to install them in /etc/projactname ?


then:


I correct myself on a point: I just checked that if I put my datafiles
in a directory like projectname/lib/datafiles/... they are all
installed for good, in my computer under /usr/lib/perl5/site_perl/5.8.6/projectname/datafiles/...
This compromise I could accept, but how do I access that install
directory name from my program?


and Rob (Sisyphus) replied:

The prefix to that directory will be contained in one of the %Config keys -
I think it's $Config{sitelib}. That being the case, so long as you 'use
Config;' , you can access the directory as
$Config{sitelib}/projectname/datafiles/ .



now: I relocated my perl library from system-wide to local, with:
export PERL5LIB=$PERL5LIB:/home/x/lib/perl/lib/perl5/site_perl/

so now the datafiles that interest me are under
/home/x/lib/perl/lib/perl5/site_perl/5.8.8/projectname/...

unfortunately I see that the %Config hash does not hold this directory.
So: what is the most elegant way to find a datafile directory which has
been installed locally?


thanks!

Alessandro Magni


I do not know about elegance, but if you have a specific module in mind,
you can load it, and then look it up in %INC. I am thinking of something
similar to

use Foo::Bar;
print "Foo::Bar corresponds to $INC{'Foo/Bar.pm'}\n";

The only other thing I can think of offhand is to traverse @INC.

Tom Wyant
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [2 Posts] View previous topic :: View next topic
The time now is Sun Nov 23, 2008 12:09 pm | All times are GMT
navigation Forum index » Programming » Perl » modules
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts change default install directory when using bdist_rpm krithika.sridhar@gmail.co python 1 Fri Jul 21, 2006 4:09 am
No new posts how to get perl to untar a tar.gz to a different directory Jack Perl 2 Fri Jul 21, 2006 12:40 am
No new posts Flash device can't find in kernel and redboot Kevin embedded 1 Thu Jul 20, 2006 10:04 am
No new posts How to find out if a certain value is in a list? TN Perl 3 Thu Jul 20, 2006 9:07 am
No new posts Win32::OLE and CAPICOM to find a certificate in certifica... dan2online Perl 0 Thu Jul 20, 2006 6:47 am

Unblock Myspace | Read this exciting weblog | Loans | Loans | Property in Spain
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1420s ][ Queries: 16 (0.0648s) ][ GZIP on - Debug on ]