ping non valide avec le module forks.pm
je travaille sur un script perl devellopé précédemment.
le linux sur lequel tournait ce script a été réinstallé et la distribution perl également.
Depuis le script ne fonctionne plus.
ci-joint la config :
[admWifi@stat1 ActivePerl-5.8]$ perl -V
Citation:
Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
Platform:
osname=linux, osvers=2.2.17, archname=i686-linux-thread-multi
uname='linux gimlet 2.2.17 #1 sun jun 25 09:24:41 est 2000 i686 unknown '
config_args='-ders -Dcc=gcc -Accflags=-DNO_HASH_SEED -Dusethreads -Duseithreads -Ud_sigsetjmp -Uinstallusrbinperl -Ulocincpth= -Uloclibpth= -Duselargefiles -Uusemallocwrap -Dinc_version_list=5.8.3/$archname 5.8.3 5.8.2/$archname 5.8.2 5.8.1/$archname 5.8.1 5.8.0/$archname 5.8.0 -Duseshrplib -Dprefix=/wifi/ActivePerl-5.8 -Dcf_by=ActiveState -Dcf_email=support@ActiveState.com'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef 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='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DNO_HASH_SEED -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DNO_HASH_SEED -fno-strict-aliasing'
ccversion='', gccversion='2.95.2 20000220 (Debian GNU/Linux)', 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='gcc', ldflags =''
libpth=/lib /usr/lib /usr/local/lib
libs=-lnsl -lndbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lposix
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc -lposix
libc=/lib/libc-2.1.3.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.1.3'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/wifi/ActivePerl-5.8/lib/5.8.4/i686-linux-thread-multi/CORE'
cccdlflags='-fpic', lddlflags='-shared'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
Locally applied patches:
ActivePerl Build 810
22751 Update to Test.pm 1.25
21540 Fix backward-compatibility issues in if.pm
Built under linux
Compiled at Jun 3 2004 12:38:49
@INC:
/wifi/ActivePerl-5.8/lib/5.8.4/i686-linux-thread-multi
/wifi/ActivePerl-5.8/lib/5.8.4
/wifi/ActivePerl-5.8/lib/site_perl/5.8.4/i686-linux-thread-multi
/wifi/ActivePerl-5.8/lib/site_perl/5.8.4
/wifi/ActivePerl-5.8/lib/site_perl
Il semble que le problème vienne de la commande ping qui ne fonctionne pas
correctement avec le module forks.pm (utilisation de threads dans le script initial)
Ci dessous un petit script pour comprendre la problèmatique :
Avec forks :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| #! /opt/ActivePerl-5.8/bin/perl
use forks;
use forks::shared;
use Net::Ping::External qw(ping);
if (! ping(host => "10.163.123.98", timeout => 2) ) {
print "ping ko\n";
}
else
{
print "ping ok \n";
}
exit 1; |
retourne "ping ko"
Sans forks :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| #! /opt/ActivePerl-5.8/bin/perl
#use forks;
#use forks::shared;
use Net::Ping::External qw(ping);
if (! ping(host => "10.163.123.98", timeout => 2) ) {
print "ping ko\n";
}
else
{
print "ping ok \n";
}
exit 1; |
retourne "ping ok"
Avez-vous une idée ou des expériences liées à l'utilisation du module fork.pm
PS : le script fonctionne correctement sur un autre serveur linux.