For Programmers: Free Programming Magazines  


Home > Archive > LDAP > January 2006 > Net::LDAP::LDIF correction









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Net::LDAP::LDIF correction
Gergely Sánta

2006-01-10, 7:31 pm

Hi!

Sorry for bothering, but I don't know, which other way should I
report this "bug" I found...
The reason I report it directly to you is, that I also solved it. The
problem is the following:

In the project, I'm working on, I needed to parse an LDIF buffer
present in memory. Module Net::LDAP::LDIF is working with files, so I
opened a memory-file, and passed it's filehandle to this module, but
it didn't work. I downloaded the source and started to search, where
could be the problem. Finally a simple replacement solved my problem
(diff file attached).

With this correction now opening a memory-file on buffer now works
too (I attached the test-script, which Iused to test this feature).

It's strange.. These two lines seems to be equivalent, but looks like
they're not..

If there's other way to report such solved bugs, I apologize for
bothering once more..

Regards,
Gergely
85c85
< local $/;
---
> local $/ = "";

#!/usr/bin/perl -w
use strict;
use LDIF;
use Data::Dumper;

my $buff = "version: 1\n";
$buff .= "dn: ou=something,dc=somewhere,dc=sk\n";
$buff .= "objectClass: myclass\n";
$buff .= "objectClass: top\n";
$buff .= "myattribute: some_value\n";

my $fd;
open $fd, '<', \$buff;

my $ldif = Net::LDAP::LDIF->new($fd);
while( not $ldif->eof ( ) ) {
my $entry = $ldif->read_entry ( );
if ( $ldif->error ( ) ) {
print "Error msg: ", $ldif->error ( ), "\n";
print "Error lines:\n", $ldif->error_lines ( ), "\n";
} else {
print
" ========================================
=======================\n";
print Data::Dumper->Dump([$entry]);
print
" ========================================
=======================\n";
}
}
$ldif->done ( );
close $fd;
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com