Cuando entra a una de las máquinas de los laboratorios de la ETSII
encontrará montado el directorio /soft/perl5lib/
y en
él algunas distribuciones de módulos Perl que he instalado.
casiano@millo:~$ cat bin/setperl5_10lib # October 2008 # source ~/bin/setperl5_10lib export PERL5LIB=/soft/perl5lib/perl5_10_1/lib/:/soft/perl5lib/perl5_10_1/lib/perl5:/soft/perl5lib/perl5_10_1/share/perl/5.8.8/ export MANPATH=$MANPATH:/soft/perl5lib/perl5_10_1/man/ # /soft/perl5lib/perl5_10_1/bin/ must be after ... export PATH=$PATH:/soft/perl5lib/perl5_10_1/bin/
Puede verla en CPAN:
http://search.cpan.org/perldoc?Regexp::Grammars
La he instalado en la ETSII. Si quieren usar esta antes de la antigua asegurense que el directorio
/soft/perl5lib/perl5_10_1/lib/site_perl/5.10.1/
figura en la variable PERL5LIB antes que el directorio
/soft/perl5lib/perl5_10_1/lib/perl5/
en el cual se encuentra la vieja versión.
He aqui un ejemplo con el depurador que ilustra la influencia del orden:
casiano@millo:~/Lregexp-grammar-examples/calculator$ perl5.10.1 -wde 0 Loading DB routines from perl5db.pl version 1.32 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main: 0 DB unshift @INC, '/soft/perl5lib/perl5_10_1/lib/perl5/' DB use Regexp::Grammars DB x $Regexp::Grammars::VERSION 0 1.001005001 DB q
Ahora añadimos en primer lugar el camino a la versión nueva:
casiano@millo:~/Lregexp-grammar-examples/calculator$ perl5.10.1 -wde 0 Loading DB routines from perl5db.pl version 1.32 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main: 0 DB unshift @INC, '/soft/perl5lib/perl5_10_1/lib/site_perl/5.10.1/' DB use Regexp::Grammars DB x $Regexp::Grammars::VERSION 0 1.002
Para usar los módulos instalados por el profesor con perl5.8.*
establezca las siguientes variables de entorno para poder
acceder a las mismas:
[casiano@tonga]~/src/perl/tests/gtk2/> cat ~/bin/setperl5lib # October 2008 # source ~/bin/setperl5lib export PERL5LIB=/soft/perl5lib/share/perl/5.8.8/:/soft/perl5lib/lib/perl/5.8.8:/soft/perl5lib/lib/perl/5.8:/soft/perl5lib/share/perl/5.8/ export MANPATH=$MANPATH:/soft/perl5lib/man/ export PATH=$PATH:/soft/perl5lib/binEn una
bash
ejecute:
$ source ~/bin/setperl5libpara establecer las variables de entorno. También puede añadir estas líneas en su fichero
~/.profile
No es buena idea sustituir el intérprete nativo de perl por otra versión.
La distribución de Linux instalada depende de la versión del intérprete
Perl. No cambie el PATH
de manera que el intérprete perl5.10.1
se ejecute antes que el nativo.
En general, para acceder a la documentación de un módulo use perldoc
en vez de man
.
Para ejecutar perl5.10
escriba el nombre seguido de la versión:
casiano@millo:~$ perl5.10.1 -V Summary of my perl5 (revision 5 version 10 subversion 1) configuration: Platform: osname=linux, osvers=2.6.24-21-generic, archname=i686-linux-thread-multi uname='linux millo 2.6.24-21-generic #1 smp tue oct 21 23:43:45 utc 2008 i686 gnulinux ' config_args='-de -Dprefix=/soft/perl5lib/perl5_10_1/ -Dusethreads' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.2.4 (Ubuntu 4.2.4-1ubuntu4)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.7.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.7' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API Built under linux Compiled at Aug 30 2009 09:34:30 %ENV: PERL5LIB="/soft/perl5lib/share/perl/5.8.8/:/soft/perl5lib/lib/perl/5.8.8:/soft/perl5lib/lib/perl/5.8:/soft/perl5lib/share/perl/5.8/" @INC: /soft/perl5lib/share/perl/5.8.8/ /soft/perl5lib/lib/perl/5.8.8 /soft/perl5lib/lib/perl/5.8 /soft/perl5lib/share/perl/5.8/ /soft/perl5lib/perl5_10_1/lib/5.10.1/i686-linux-thread-multi /soft/perl5lib/perl5_10_1/lib/5.10.1 /soft/perl5lib/perl5_10_1/lib/site_perl/5.10.1/i686-linux-thread-multi /soft/perl5lib/perl5_10_1/lib/site_perl/5.10.1Para acceder a la documentación relacionada con Perl 5.10 use el script
perl5.10.1.doc
:
casiano@millo:~$ perl5.10.1.doc -h perldoc [options] PageName|ModuleName|ProgramName... perldoc [options] -f BuiltinFunction perldoc [options] -q FAQRegex Options: -h Display this help message -V report version -r Recursive search (slow) -i Ignore case -t Display pod using pod2text instead of pod2man and nroff (-t is the default on win32 unless -n is specified) -u Display unformatted pod text -m Display module's file in its entirety -n Specify replacement for nroff -l Display the module's file name -F Arguments are file names, not modules -v Verbosely describe what's going on -T Send output to STDOUT without any pager -d output_filename_to_send_to -o output_format_name -M FormatterModuleNameToUse -w formatter_option:option_value -L translation_code Choose doc translation (if any) -X use index if present (looks for pod.idx at /soft/perl5lib/perl5_10_1/lib/5.10.1/i686-linux-thread-multi) -q Search the text of questions (not answers) in perlfaq[1-9] PageName|ModuleName... is the name of a piece of documentation that you want to look at. You may either give a descriptive name of the page (as in the case of `perlfunc') the name of a module, either like `Term::Info' or like `Term/Info', or the name of a program, like `perldoc'. BuiltinFunction is the name of a perl function. Will extract documentation from `perlfunc'. FAQRegex is a regex. Will search perlfaq[1-9] for and extract any questions that match. Any switches in the PERLDOC environment variable will be used before the command line arguments. The optional pod index file contains a list of filenames, one per line. [Perldoc v3.14_04]
Visite esta página de vez en cuando. Es posible que añada algún nuevo camino de búsqueda de librerías y/o ejecutables.
Casiano Rodríguez León