Click here to get back home

most elegant way to find an installed datafile directory

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
most elegant way to find an installed datafile directory alexxx.magni 07-07-2006
Get Chitika Premium
Posted by alexxx.magni on July 7, 2006, 9:07 am
Please log in for more thread options


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. That being the case, so long as you 'use
>Config;' , you can access the directory as
>$Config/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


Posted by harryfmudd [AT] comcast [DOT] on July 7, 2006, 5:07 pm
Please log in for more thread options


alexxx.magni@gmail.com wrote:

> 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. That being the case, so long as you 'use
>>Config;' , you can access the directory as
>>$Config/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\n";

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

Tom Wyant

Similar ThreadsPosted
What is installed December 8, 2005, 11:18 am
Traverse a directory July 13, 2006, 2:10 pm
2 versions of a module installed? December 29, 2004, 1:27 pm
Updating installed modules? June 23, 2006, 3:36 am
Finding installed modules January 8, 2008, 4:52 pm
Glob and Traversing Directory July 14, 2006, 12:13 pm
List of all modules installed on a system August 8, 2007, 1:41 pm
New Script Directory needs your scripts listed September 3, 2005, 6:32 pm
Modules not installing to standard LIB directory November 17, 2005, 8:14 am
Current Directory when test.pl runs ? December 14, 2004, 9:31 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap