You are trying to ->write to an LDIF object that was opened for read.
You need to create a new object for write
$ldif_out = Net::LDAP::LDIF->new('-', 'w');
Graham.
On Tue, Feb 06, 2001 at 09:44:41AM -0800, Jeremy Fassler wrote:
> Basically what I'm trying to do is pull information out of an LDIF file,
> and put it into an array or hash, so I can display it to the user and
> export it into a database. The commented line #print "$entry\n"; was
> taken out becuase it just prints the hash reference, and not the data
> itself, so I was told to use $ldif->write($entry); instead. However,
> when I do this, it outputs no data. My test ldif file has 3 entries,
> and if I uncomment that line, it does print 3 hash references. So I know
> it is reading the file, but I cant get any info out of it!
>
> Thanks in advance! Here is my code. (win32 platform)
>
>
> #!d:/perl/bin/perl.exe
>
> use Net::LDAP::LDIF;
>
> $ldif = Net::LDAP::LDIF->new( "D:/test.ldif", "r" );
>
> while( $entry = $ldif->read() )
>
> {
>
> #print "$entry\n";
>
> $ldif->write($entry);
>
> }
>
> $ldif->done();
>
Content-Description: Card for Jeremy Fassler
|