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:
Using perl Syntax Highlighting
- #!/usr/bin/perl -w
- use strict;
- use File::Path;
- use File::Copy;
- use lib '/usr/lib/perl5/site_perl/5.8.8';
- use Image::Grab qw(grab);
- my $img = new Image::Grab;
- $img->url('http://webcam.cnelbalis.com/record/current.jpg');
- $img->grab;
- if($img->image){
- # Salvamos la imagen al disco
- open(IMAGEN, ">img_Balis.jpg") || die"No se pudo crear archivo: $!";
- binmode IMAGEN; #para derivados de MSDOS.
- print IMAGEN $img->image;
- close IMAGEN;
- # ÉXITO
- print "La imagen fue descargada con éxito\n";
- }else{
- print "NO EXISTE LA IMAGEN\n";
- }
- exit(1);
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4
Y el error que sale es
Using bash Syntax Highlighting
- [enric@localhost ~]$ ./download_images.pl
- 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.
- Compilation failed in require at /usr/lib/perl5/5.8.8/i386-linux-thread-multi/Scalar/Util.pm line 11.
- Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/HTML/Element.pm line 46.
- BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/HTML/Element.pm line 49.
- Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/HTML/TreeBuilder.pm line 62.
- BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/HTML/TreeBuilder.pm line 62.
- Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Image/Grab.pm line 12.
- Compilation failed in require at ./download_images.pl line 8.
- BEGIN failed--compilation aborted at ./download_images.pl line 8.
Coloreado en 0.003 segundos, usando GeSHi 1.0.8.4
Si hago perl -v
Using bash Syntax Highlighting
- [enric@localhost ~]$ perl -v
- This is perl, v5.10.1 (*) built for i686-linux-thread-multi
- Copyright 1987-2009, Larry Wall
- Perl may be copied only under the terms of either the Artistic License or the
- GNU General Public License, which may be found in the Perl 5 source kit.
- Complete documentation for Perl, including FAQ lists, should be found on
- this system using "man perl" or "perldoc perl". If you have access to the
- 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
Using bash Syntax Highlighting
- [enric@localhost ~]$ perl -V
- Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
- Platform:
- osname=linux, osvers=2.6.18-348.1.1.el5, archname=i686-linux-thread-multi
- 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 '
- config_args='-de -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.1.2 20080704 (Red Hat 4.1.2-54)', 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.5.so, so=so, useshrplib=false, libperl=libperl.a
- gnulibc_version='2.5'
- 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 May 8 2013 00:21:18
- %ENV:
- PERL5LIB="/home/enric/perl5/lib/perl5:/home/enric/perl5/lib/perl5:"
- PERL_LOCAL_LIB_ROOT=":/home/enric/perl5:/home/enric/perl5"
- PERL_MB_OPT="--install_base /home/enric/perl5"
- PERL_MM_OPT="INSTALL_BASE=/home/enric/perl5"
- @INC:
- /home/enric/perl5/lib/perl5/i686-linux-thread-multi
- /home/enric/perl5/lib/perl5
- /home/enric/perl5/lib/perl5/i686-linux-thread-multi
- /home/enric/perl5/lib/perl5
- /usr/local/lib/perl5/5.10.1/i686-linux-thread-multi
- /usr/local/lib/perl5/5.10.1
- /usr/local/lib/perl5/site_perl/5.10.1/i686-linux-thread-multi
- /usr/local/lib/perl5/site_perl/5.10.1
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...
Using perl Syntax Highlighting
- #!/usr/bin/perl
- my $url = 'http://webcam.cnelbalis.com/record/current.jpg';
- use LWP::Simple;
- my $content = get $url;
- open XX,">img_Balis.jpg";
- print XX $content;
- binmode(XX);
- close XX;
- print "content-type: text/plain\n\nDONE";
- exit;
Coloreado en 0.001 segundos, usando GeSHi 1.0.8.4
¿Alguna idea? Gracias.