most elegant way to find an installed datafile directory

Ask a Question related to PERL Modules, Design and Development.

  1. #1

    Default most elegant way to find an installed datafile directory

    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

    alexxx.magni@gmail.com Guest

  2. Similar Questions and Discussions

    1. INSTALLED, now HOW I FIND AND USE?
      Ok, this is probably a stupid overlook by me or something very simple..but instead of me banging my head and losing my temper i figure I would...
    2. ExtUtils::Installed can't find Prima?
      I try run the script: use ExtUtils::Installed; my $instmod = ExtUtils::Installed->new(); foreach my $module ($instmod->modules()) { my $version...
    3. [newbie]how to find out a feature is installed
      hi, how can i find out if a feature (i.e. procmail) is installed? Guido -- Guido Lenk University of...
    4. How to find out installed packages on Unix
      "Wang, Vincent" <viwang@nortelnetworks.com> wrote in message news:3EA9A873.EA35E48C@nortelnetworks.com... Try this (you'll need...
    5. How do I find out what graphics card i have installed?
      The box your laptop came with should say...or even the manufacturer's website. If you go to Control Panel/Administrative tools/Computer...
  3. #2

    Default Re: most elegant way to find an installed datafile directory

    [email]alexxx.magni@gmail.com[/email] 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{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
    harryfmudd [AT] comcast [DOT] net Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139