Permalink
Browse files

RT#44110 Fix Net::LDAP::LDIF->current_lines

  • Loading branch information...
1 parent d7f2c7a commit e79c9ea7a0a77fd77c1572ebb6e8e7353726311d @gbarr gbarr committed Mar 12, 2010
Showing with 22 additions and 16 deletions.
  1. +1 −0 lib/Net/LDAP/LDIF.pm
  2. +21 −16 t/00ldif-entry.t
View
@@ -126,6 +126,7 @@ sub _read_lines {
}
}
$self->eof(1) if (!defined($ln));
+ $self->{_current_lines} = $entry;
$entry =~ s/\r?\n //sgo; # un-wrap wrapped lines
$entry =~ s/\r?\n\t/ /sgo; # OpenLDAP extension !!!
@ldif = split(/^/, $entry);
View
@@ -5,7 +5,7 @@ BEGIN {
}
-print "1..15\n";
+print "1..16\n";
use Net::LDAP::LDIF;
@@ -17,21 +17,7 @@ my $cmpfile2 = $infile;
my $ldif = Net::LDAP::LDIF->new($infile,"r");
-@entry = $ldif->read;
-
-ok($ldif->version == 1, "version == 1");
-
-Net::LDAP::LDIF->new($outfile1,"w")->write(@entry);
-Net::LDAP::LDIF->new($outfile2,"w", version => 1)->write(@entry);
-
-ok(!compare($cmpfile1,$outfile1), $cmpfile1);
-
-ok(!compare($cmpfile2,$outfile2), $cmpfile2);
-
-$e = $entry[0];
-
-is($e->ldif, <<'LDIF', "ldif method");
-
+my $entry0_ldif = <<'LDIF';
dn: o=University of Michigan, c=US
objectclass: top
objectclass: organization
@@ -55,6 +41,25 @@ lastmodifiedby: cn=manager, o=university of michigan, c=US
associateddomain: umich.edu
LDIF
+my $e = $ldif->read_entry;
+my @lines = $ldif->current_lines;
+is(join("",@lines),$entry0_ldif,"ldif lines");
+
+my @entry = ($e, $ldif->read);
+
+ok($ldif->version == 1, "version == 1");
+
+Net::LDAP::LDIF->new($outfile1,"w")->write(@entry);
+Net::LDAP::LDIF->new($outfile2,"w", version => 1)->write(@entry);
+
+ok(!compare($cmpfile1,$outfile1), $cmpfile1);
+
+ok(!compare($cmpfile2,$outfile2), $cmpfile2);
+
+
+is($e->ldif, "\n$entry0_ldif", "ldif method");
+
+
is($e->ldif(change => 1), <<'LDIF', "ldif method");
dn: o=University of Michigan, c=US

0 comments on commit e79c9ea

Please sign in to comment.