• Publicidad

Problemas con List::Util versión 1.21

¿Apenas comienzas con Perl? En este foro podrás encontrar y hacer preguntas básicas de Perl con respuestas aptas a tu nivel.

Problemas con List::Util versión 1.21

Notapor enric73 » 2013-06-27 12:26 @559

Hola compañeros,

Tengo un error en un script que hasta hace poco funcionaba y ahora al ejecutarlo salen errores...

El script baja una imagen de una web y la guarda en un directorio local. He aprovechado el script del tutorial
Descargar imágenes vía HTTP.

El script modificado y que antes me funcionaba es este:
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. #!/usr/bin/perl -w
  2.  
  3. use strict;
  4. use File::Path;
  5. use File::Copy;
  6. use  lib '/usr/lib/perl5/site_perl/5.8.8';
  7. use Image::Grab qw(grab);
  8.  
  9. my $img = new Image::Grab;
  10. $img->url('http://webcam.cnelbalis.com/record/current.jpg');
  11. $img->grab;
  12.  
  13. if($img->image){
  14.  
  15. # Salvamos la imagen al disco
  16. open(IMAGEN, ">img_Balis.jpg") || die"No se pudo crear archivo: $!";
  17. binmode IMAGEN; #para derivados de MSDOS.
  18. print IMAGEN $img->image;
  19. close IMAGEN;
  20.  
  21. # ÉXITO
  22. print "La imagen fue descargada con éxito\n";
  23.  
  24. }else{
  25. print "NO EXISTE LA IMAGEN\n";
  26. }
  27.  
  28. exit(1);
  29.  
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4


Y el error que sale es
Sintáxis: [ Descargar ] [ Ocultar ]
Using bash Syntax Highlighting
  1. [enric@localhost ~]$ ./download_images.pl
  2. List::Util object version 1.21 does not match bootstrap parameter 1.27 at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/XSLoader.pm line 94.
  3. Compilation failed in require at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/Scalar/Util.pm line 11.
  4. Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/HTML/Element.pm line 46.
  5. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/HTML/Element.pm line 49.
  6. Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/HTML/TreeBuilder.pm line 62.
  7. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/HTML/TreeBuilder.pm line 62.
  8. Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Image/Grab.pm line 12.
  9. Compilation failed in require at ./download_images.pl line 8.
  10. BEGIN failed--compilation aborted at ./download_images.pl line 8.
  11.  
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4


Si hago perl -v
Sintáxis: [ Descargar ] [ Ocultar ]
Using bash Syntax Highlighting
  1. [enric@localhost ~]$ perl -v
  2.  
  3. This is perl, v5.10.1 (*) built for i686-linux-thread-multi
  4.  
  5. Copyright 1987-2009, Larry Wall
  6.  
  7. Perl may be copied only under the terms of either the Artistic License or the
  8. GNU General Public License, which may be found in the Perl 5 source kit.
  9.  
  10. Complete documentation for Perl, including FAQ lists, should be found on
  11. this system using "man perl" or "perldoc perl".  If you have access to the
  12. Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4


Si hago perl -V
Sintáxis: [ Descargar ] [ Ocultar ]
Using bash Syntax Highlighting
  1. [enric@localhost ~]$ perl -V
  2. Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
  3.    
  4.   Platform:
  5.     osname=linux, osvers=2.6.18-348.1.1.el5, archname=i686-linux-thread-multi
  6.     uname='linux localhost.localdomain 2.6.18-348.1.1.el5 #1 smp tue jan 22 16:24:03 est 2013 i686 athlon i386 gnulinux '
  7.     config_args='-de -Dusethreads'
  8.     hint=recommended, useposix=true, d_sigaction=define
  9.     useithreads=define, usemultiplicity=define
  10.     useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
  11.     use64bitint=undef, use64bitall=undef, uselongdouble=undef
  12.     usemymalloc=n, bincompat5005=undef
  13.   Compiler:
  14.     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',
  15.     optimize='-O2',
  16.     cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
  17.     ccversion='', gccversion='4.1.2 20080704 (Red Hat 4.1.2-54)', gccosandvers=''
  18.     intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  19.     d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
  20.     ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
  21.     alignbytes=4, prototype=define
  22.   Linker and Libraries:
  23.     ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
  24.     libpth=/usr/local/lib /lib /usr/lib
  25.     libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  26.     perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
  27.     libc=/lib/libc-2.5.so, so=so, useshrplib=false, libperl=libperl.a
  28.     gnulibc_version='2.5'
  29.   Dynamic Linking:
  30.     dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
  31.     cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib -fstack-protector'
  32.  
  33.  
  34. Characteristics of this binary (from libperl):
  35.   Compile-time options: MULTIPLICITY PERL_DONT_CREATE_GVSV
  36.                         PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP USE_ITHREADS
  37.                         USE_LARGE_FILES USE_PERLIO USE_REENTRANT_API
  38.   Built under linux
  39.   Compiled at May  8 2013 00:21:18
  40.   %ENV:
  41.     PERL5LIB="/home/enric/perl5/lib/perl5:/home/enric/perl5/lib/perl5:"
  42.     PERL_LOCAL_LIB_ROOT=":/home/enric/perl5:/home/enric/perl5"
  43.     PERL_MB_OPT="--install_base /home/enric/perl5"
  44.     PERL_MM_OPT="INSTALL_BASE=/home/enric/perl5"
  45.   @INC:
  46.     /home/enric/perl5/lib/perl5/i686-linux-thread-multi
  47.     /home/enric/perl5/lib/perl5
  48.     /home/enric/perl5/lib/perl5/i686-linux-thread-multi
  49.     /home/enric/perl5/lib/perl5
  50.     /usr/local/lib/perl5/5.10.1/i686-linux-thread-multi
  51.     /usr/local/lib/perl5/5.10.1
  52.     /usr/local/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi
  53.     /usr/local/lib/perl5/site_perl/5.10.1
  54.  
Coloreado en 0.002 segundos, usando GeSHi 1.0.8.4


El siguiente script sí que baja bien la imagen, pero igualmente me gustaría saber el motivo por el cual el anterior script ha dejado de funcionar...
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. #!/usr/bin/perl
  2.  
  3. my $url = 'http://webcam.cnelbalis.com/record/current.jpg';
  4.  
  5. use LWP::Simple;
  6. my $content = get $url;
  7.  
  8. open XX,">img_Balis.jpg";
  9. print XX $content;
  10. binmode(XX);
  11. close XX;
  12.  
  13. print "content-type: text/plain\n\nDONE";
  14. exit;
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4


¿Alguna idea? Gracias.
enric73
Perlero nuevo
Perlero nuevo
 
Mensajes: 154
Registrado: 2012-03-16 06:27 @311

Publicidad

Re: Problemas con List::Util versión 1.21

Notapor explorer » 2013-06-27 12:54 @579

Los errores de tipo bootstrap suelen ser debidos a que estamos intentando cargar módulos que han sido compilados en una versión de Perl distinta de la de nuestro intérprete.

Fíjate que perl -v dice que estás usando un Perl v5.10.1, pero el error dice que estás usando un Perl v5.8.8.

Necesitas un poco de limpieza...

De momento... lo que puedes hacer es comentar la línea 6 del programa, para que el perl vaya a buscar las bibliotecas que residen en las rutas indicadas al final de perl -V (que son las que coinciden con su número de versión, claro).
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: Problemas con List::Util versión 1.21

Notapor enric73 » 2013-06-27 13:14 @593

Sí, explorer, tengo un lio por aquí importante entre dos versiones de Perl...

He comentado la línea 6:
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. #!/usr/bin/perl -w
  2.  
  3. use strict;
  4. use File::Path;
  5. use File::Copy;
  6. #use  lib '/usr/lib/perl5/site_perl/5.8.8';
  7. use Image::Grab qw(grab);
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4


pero sigue el error...
Sintáxis: [ Descargar ] [ Ocultar ]
Using bash Syntax Highlighting
  1. [enric@localhost ~]$ ./download_images.pl
  2. List::Util object version 1.21 does not match bootstrap parameter 1.27 at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/XSLoader.pm line 94.
  3. Compilation failed in require at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/Scalar/Util.pm line 11.
  4. Compilation failed in require at /home/enric/perl5/lib/perl5/HTML/Element.pm line 46.
  5. BEGIN failed--compilation aborted at /home/enric/perl5/lib/perl5/HTML/Element.pm line 49.
  6. Compilation failed in require at /home/enric/perl5/lib/perl5/HTML/TreeBuilder.pm line 62.
  7. BEGIN failed--compilation aborted at /home/enric/perl5/lib/perl5/HTML/TreeBuilder.pm line 62.
  8. Compilation failed in require at /home/enric/perl5/lib/perl5/Image/Grab.pm line 12.
  9. Compilation failed in require at ./download_images.pl line 8.
  10. BEGIN failed--compilation aborted at ./download_images.pl line 8.
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4
enric73
Perlero nuevo
Perlero nuevo
 
Mensajes: 154
Registrado: 2012-03-16 06:27 @311

Re: Problemas con List::Util versión 1.21

Notapor explorer » 2013-06-27 13:48 @616

A ver...

Si creo un programa así:
Sintáxis: [ Descargar ] [ Ocultar ]
Using perl Syntax Highlighting
  1. #!/usr/bin/perl -v
  2. 1;
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4

y lo ejecuto, ¿qué sale? v5.8.8 o v5.10.1.

Entonces es posible que el problema esté en definir el intérprete como /usr/bin/perl, que será distinto del perl que ejecutas desde la línea de comandos.

Así que hay que saber dónde está el perl v5.10.1.

Prueba a ejecutar
Sintáxis: [ Descargar ] [ Ocultar ]
Using bash Syntax Highlighting
  1. $ which perl
  2. /usr/bin/perl
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4

y entonces sabrás dónde está ese perl. Y lo cambias en la primera línea del programa.
JF^D Perl programming & Raku programming. Grupo en Telegram: https://t.me/Perl_ES
Avatar de Usuario
explorer
Administrador
Administrador
 
Mensajes: 14480
Registrado: 2005-07-24 18:12 @800
Ubicación: Valladolid, España

Re: Problemas con List::Util versión 1.21

Notapor enric73 » 2013-06-28 03:19 @180

Hola, explorer.

Ahora sí, tengo el perl 5.10.1 en:

Sintáxis: [ Descargar ] [ Ocultar ]
Using bash Syntax Highlighting
  1. [enric@localhost ~]$ which perl
  2. /usr/local/bin/perl
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4


Ahora se ejecuta sin problemas. Gracias una vez más.

Saludos.
enric73
Perlero nuevo
Perlero nuevo
 
Mensajes: 154
Registrado: 2012-03-16 06:27 @311


Volver a Básico

¿Quién está conectado?

Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 50 invitados

cron