problema de la ruta de la herramienta de celosía

I have downloaded and installed a perl tool (lattice-tool). But it is in my local directory. While I'm running it says can't locate lib file) which is available in lib folder of my local directory. I hope it will be set right if I set path variable. If so, how do I set it?

preguntado el 31 de enero de 12 a las 08:01

4 Respuestas

For use lib you have to use full path, and you are should not use relativ path like this.

use '../lib';#not working in all times.

Scenario: Your scripts in something/bin/, your lib is something/lib/

If you use relativ path, you should call your program like this:

cd something/bin/ && ./

If you would like to use relativ path, use FindBin to find your current path:

use FindBin;
use lib "$FindBin::Bin/../lib";#your lib realitv to your script
use lib $FindBin::Bin;#your current script full path

Then you could call your program from anywhere it will always find its lib realtiv to itself.

cd ~   
something/bin/ ti will use the correct lib

Respondido el 31 de enero de 12 a las 14:01

In my scripts, I have the following (which I'm sure can be improved, but it has worked thus far):

my $mydir;  BEGIN { ($mydir) = ($0 =~ m#(.*)[/\\]#) or $mydir = '.'; }
use lib "$mydir/lib";

So the script tries to determine its own directory and then tells Perl to look for libraries within the lib subdirectory of that directory.

Respondido el 31 de enero de 12 a las 13:01

You need to add 'lib' to the directories perl searches for modules. You can do this with the -I bandera:

 perl -Ilib

Respondido el 31 de enero de 12 a las 12:01

Otra opción es configurar el $PERLLIB Variable ambiental. - reinierpost

Utilizan lib:

use lib 'lib';

lib also checks for architecture specific sub directories under lib to make sure machine-dependent libraries are loaded.

EDIT: Note that directories passed to lib are relative to your current working directory, so that if you want to execute your script from another location you should use use lib '/home/user1126070/lib'.

Desde perlvar:

The array @INC contains the list of places that the do EXPR , require, or use
constructs look for their library files. It initially consists of the arguments
to any -I command-line switches, followed by the default Perl library, probably
/usr/local/lib/perl, followed by ".", to represent the current directory. ("."
will not be appended if taint checks are enabled, either by -T or by -t .) If you
need to modify this at runtime, you should use the use lib pragma to get the
machine-dependent library properly loaded [...]

Respondido el 31 de enero de 12 a las 15:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.