[Haifux] Question :argument from File or Command line ; LDAP

2004-08-09 Thread Nir Abulaffio
Hi all,
This is a problem we have come across. Any suggestions?
Nir.

when I read from a file
$line=file ;
chop($line);
and split :
($uid,$fname,$sname) = split(/\s+/,$line);

After a call to function of LDAP (add),I receive an endless loop in
function of LDAP .

If I get variable $uid as argument from command line :
Prompt: Program.pl uid

Then the function of LDAP works OK !

Why ?
If I check variable $uid from command line and from file with
function cmp, I receive 0 .

Prompt  uname -a
Linux radiatora 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/Linux

Prompt   perl -v

This is perl, v5.8.0 built for i386-linux-thread-multi
(with 1 registered patch, see perl -V for more detail)

Copyright 1987-2002, 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.com/, the Perl Home Page.


Prompt  perl -V

Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
osname=linux, osvers=2.4.20-2.48smp, archname=i386-linux-thread-multi
uname='linux str'
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -g -Dmyhostname=localhost 
[EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr 
-Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr 
-Dotherlibdirs=/usr/lib/perl5/5.8.0 -Duseshrplib -Dusethreads -Duseithreads 
-Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow 
-Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly 
-Dpager=/usr/bin/less -isr'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef'
 useithreads=define usemultiplicity=
useperlio= d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=un uselongdouble=
usemymalloc=, bincompat5005=undef
  Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING 
-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 
-I/usr/include/gdbm',
optimize='',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING 
-fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='3.2.2 20030213 (Red Hat Linux 8.0 3.2.2-1)', 
gccosandvers='' gccversion='3.2.2 200302'
intsize=e, longsize= , ptrsize=p, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long'
k', ivsize=4'
ivtype='long'
known_ext, nvtype='double'
o_nonbl', nvsize=, Off_t='', lseeksize=8
alignbytes=4, prototype=define
  Linker and Libraries:
ld='gcc'
l', ldflags =' -L/usr/local/lib'
ldf'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=
libc=/lib/libc-2.3.1.so, so=so, useshrplib=true, libperl=libper
gnulibc_version='2.3.1'
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so', d_dlsymun=undef, ccdlflags='-rdynamic 
-Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC'
ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5', lddlflags='s Unicode/Normalize XS/A'


Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES 
PERL_IMPLICIT_CONTEXT
  Locally applied patches:
MAINT18379
  Built under linux
  Compiled at Feb 18 2003 22:19:53
  @INC:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
.




--
Haifa Linux Club Mailing List (http://www.haifux.org)
To unsub send an empty message to [EMAIL PROTECTED]




Re: [Haifux] Question :argument from File or Command line ; LDAP

2004-08-09 Thread emild
Hi,

I am neither a Perl nor an LDAP expert, but here are some hints:
1) it's better to use chomp instead of chop
2) I think it's better if you pass just a single space (' ') as the first
parameter to split() (without slashes, i.e. the call would be split(' ',$line);
). This means that split() will split using *any whitespace character*, which
is probably what you want.


 Hope this helps,

   Emil

Quoting Nir Abulaffio [EMAIL PROTECTED]:

 Hi all,
 This is a problem we have come across. Any suggestions?
 Nir.
 
 when I read from a file
 $line=file ;
 chop($line);
 and split :
 ($uid,$fname,$sname) = split(/\s+/,$line);
 
 After a call to function of LDAP (add),I receive an endless loop in
 function of LDAP .
 
 If I get variable $uid as argument from command line :
 Prompt: Program.pl uid
 
 Then the function of LDAP works OK !
 
 Why ?
 If I check variable $uid from command line and from file with
 function cmp, I receive 0 .
 
 Prompt  uname -a
 Linux radiatora 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386
 GNU/Linux
 
 Prompt   perl -v
 
 This is perl, v5.8.0 built for i386-linux-thread-multi
 (with 1 registered patch, see perl -V for more detail)
 
 Copyright 1987-2002, 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.com/, the Perl Home Page.
 
 
 Prompt  perl -V
 
 Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
   Platform:
 osname=linux, osvers=2.4.20-2.48smp, archname=i386-linux-thread-multi
 uname='linux str'
 config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -g
 -Dmyhostname=localhost [EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat,
 Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux
 -Dvendorprefix=/usr -Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.0
 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid
 -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm
 -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly
 -Dpager=/usr/bin/less -isr'
 hint=recommended, useposix=true, d_sigaction=define
 usethreads=define use5005threads=undef'
  useithreads=define usemultiplicity=
 useperlio= d_sfio=undef uselargefiles=define usesocks=undef
 use64bitint=undef use64bitall=un uselongdouble=
 usemymalloc=, bincompat5005=undef
   Compiler:
 cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
 -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE
 -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
 optimize='',
 cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING
 -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
 ccversion='', gccversion='3.2.2 20030213 (Red Hat Linux 8.0 3.2.2-1)',
 gccosandvers='' gccversion='3.2.2 200302'
 intsize=e, longsize= , ptrsize=p, doublesize=8, byteorder=1234
 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
 ivtype='long'
 k', ivsize=4'
 ivtype='long'
 known_ext, nvtype='double'
 o_nonbl', nvsize=, Off_t='', lseeksize=8
 alignbytes=4, prototype=define
   Linker and Libraries:
 ld='gcc'
 l', ldflags =' -L/usr/local/lib'
 ldf'
 libpth=/usr/local/lib /lib /usr/lib
 libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
 perllibs=
 libc=/lib/libc-2.3.1.so, so=so, useshrplib=true, libperl=libper
 gnulibc_version='2.3.1'
   Dynamic Linking:
 dlsrc=dl_dlopen.xs, dlext=so', d_dlsymun=undef, ccdlflags='-rdynamic
 -Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE'
 cccdlflags='-fPIC'
 ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5', lddlflags='s
 Unicode/Normalize XS/A'
 
 
 Characteristics of this binary (from libperl):
   Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
 PERL_IMPLICIT_CONTEXT
   Locally applied patches:
   MAINT18379
   Built under linux
   Compiled at Feb 18 2003 22:19:53
   @INC:
 /usr/lib/perl5/5.8.0/i386-linux-thread-multi
 /usr/lib/perl5/5.8.0
 /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
 /usr/lib/perl5/site_perl/5.8.0
 /usr/lib/perl5/site_perl
 /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
 /usr/lib/perl5/vendor_perl/5.8.0
 /usr/lib/perl5/vendor_perl
 /usr/lib/perl5/5.8.0/i386-linux-thread-multi
 /usr/lib/perl5/5.8.0
 .
 
 
 
 
 --
 Haifa Linux Club Mailing List (http://www.haifux.org)
 To unsub send an empty message to [EMAIL PROTECTED]