From: Graham B. <gb...@po...> - 2000-06-26 11:20:32
|
On Mon, Jun 26, 2000 at 12:51:22PM +0200, Bouarich, Reda wrote: > Actually i would like to open the change.ldif file to create the entries > that are set in that file. In other words you want to open if for reading like I said. > I did concerning the write ENTRIES op. > Hopw could i do? If you want to add entries from an LDIF file $ldif = Net::LDAP::LDIF->new("/usr/reda/LDIF/change.ldif", "r" ); $ldap->add($entry) while ($entry = $ldif->read); Should work. Graham. > -----Original Message----- > From: Graham Barr [mailto:gb...@po...] > Sent: Monday, June 26, 2000 12:42 PM > To: Bouarich, Reda > Cc: 'per...@li...' > Subject: Re: LDIF use > > > On Mon, Jun 26, 2000 at 12:29:35PM +0200, Bouarich, Reda wrote: > > > > Hello everyone, > > I'm trying to update my DIT using an LDIF operation: > > i'mn doing like the following: > > > > $ldif = Net::LDAP::LDIF->new("/usr/reda/LDIF/change.ldif", "w" ); > > while( $entry = $ldif->write() ) { > > print " \n\n EN COURS EN COURS EN COURS EN COURS \n\n"; > > } > > $ldif->done(); > > I think you have things backwards. You have opened the file for write (to > the file) > and are attempting to write nothing to it. > > Did you mean to open it for read and call $entry = $ldif->read() ?? > > > but it doesn't seem to work, i have the following error message: > > > > Can't locate object method "dn" via package "ENTRIES" at > > lib/Net/LDAP/LDIF.pm line 167 > > Odd, LDIF.pm has no reference to ENTRIES. Did you perhaps pass the string > 'ENTRIES' in > as an argument to write ? > > Graham. |