in reply to Re: finding installed module directory
in thread finding installed module directory

Funny, I have this in my 'debug' function:
print "$_ => $INC{$_}\n" for sort keys %INC;
which is a standard part of every job I do, that why I can be usre which modules, and from where they have been loaded. It also means that you can add directories to the search path, and you can see just what is happening, for example:
#!/usr/bin/perl -w use strict; use FindBin; use lib "$FindBin::Bin/lib"; use InContact::Util; print "$_ => $INC{$_}\n" for sort keys %INC;
In my actual debugging module I read a single HASH with the /lib pointed to, then one with it disabled, then I can 'substract' one fomr the otehr and find out what the dependencies for my own modules are.

jdtoronto

Replies are listed 'Best First'.
Re^3: finding installed module directory
by alexxx (Novice) on Jul 11, 2006 at 13:16 UTC
    thanks,with:
    my $jroot=""; foreach my $a (keys %INC) {if ($INC{$a}=~/(.*)jinit.pm/){$jroot=$1}} die "I cannot find datadirectory\n" if ($jroot eq "");
    I got what I wanted.
    Still, I don't like to use the pattern "jinit.pm" (the module name itself) hardcoded inside, to find the current directory - but it's just a problem of elegance, nothing more...

    alessandro