Maybe see File::HomeDir.
Note that on Windows, C:\Program Files is not universal - it might localized to the language that Windows was installed to.
There is no universal idea of where libraries get installed to, even on Linuxish OSes, you might have /lib, /usr/lib and /lib64.
Maybe you will get better answers if you can tell us what exact problem you are trying to solve.
| [reply] [d/l] [select] |
> "Note that on Windows, C:\Program Files is not universal - it might localized to the language that Windows was installed to."
Yes, that's why I was looking for a lib, that find such dirs, depending, on what OS, the perl program is launched.
Unfortunately, File::HomeDir is not a standard module. It's not helping.
It's like a catch 22, I order to run a program with libraries, I need to be able to tell my program to tell, where those libraries are. In order to tell, where the libraries are, I have to tell load a library, that can tell it. That's why I need a module, or a variable, that's is standard on perl distros.
| [reply] |
You can usually assume that your libraries are in some fixed place relative to the script path which you can find as $0.
Example:
# untested!
use File::Spec;
BEGIN {
my $script = File::Spec->rel2abs($0);
my ($drive, $dir) = File::Spec->splitpath($script);
my $base = File::Spec->catpath($drive, $dir);
if ($^O eq 'MSWin32') {
push @INC, "$base\\lib";
}
else {
push @INC, "$base/../lib";
}
}
You just have to ensure that your Perl applications are installed using the fixed directory structure matching your code expectations.
Update: Also, on Windows you may like to store the path to your application on the registry when it is installed. | [reply] [d/l] [select] |
There may be some useful modules with your purpose in mind, here:
Cpan search: Find::lib
There is likely to be something there which will be able to help you, or can be modified to spec. hth
| [reply] |
I need a standard module, because it's like a catch 22, I order to run a program with libraries, I need to be able to tell my program to tell, where those libraries are. In order to tell, where the libraries are, I have to tell load a library, that can tell it. That's why I need a module, or a variable, that's is standard on perl distros.
| [reply] |
| [reply] |