Update of /cvsroot/perl-ldap/ldap/lib/Net/LDAP
In directory usw-pr-cvs1:/tmp/cvs-serv2005/lib/Net/LDAP
Modified Files:
LDIF.pm
Log Message:
Add support for the version number line
Index: LDIF.pm
===================================================================
RCS file: /cvsroot/perl-ldap/ldap/lib/Net/LDAP/LDIF.pm,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- LDIF.pm 2002/01/31 13:32:25 1.14
+++ LDIF.pm 2002/02/04 14:58:35 1.15
@@ -9,7 +9,7 @@
require Net::LDAP::Entry;
use vars qw($VERSION);
-$VERSION = "0.10";
+$VERSION = "0.11";
my %mode = qw(w > r < a >>);
@@ -106,6 +106,11 @@
return unless @ldif;
shift @ldif if @ldif && $ldif[0] !~ /\D/;
+ if (@ldif and $ldif[0] =~ /^version:\s+(\d+)/) {
+ $self->{version} = $1;
+ shift @ldif;
+ }
+
if (@ldif <= 1) {
$self->_error("LDIF entry is not valid", @ldif);
return;
@@ -357,7 +362,12 @@
# Skip entry if there is nothing to write
next if $type eq 'modify' and !@changes;
- print "\n" if $self->{write_count}++;
+ if ($self->{write_count}++) {
+ print "\n";
+ }
+ else {
+ print "version: $self->{version}\n" if defined $self->{version};
+ }
_write_dn($entry->dn,$self->{'encode'},$wrap);
print "changetype: $type\n";
@@ -395,7 +405,12 @@
}
else {
- print "\n" if $self->{write_count}++;
+ if ($self->{write_count}++) {
+ print "\n";
+ }
+ else {
+ print "version: $self->{version}\n" if defined $self->{version};
+ }
_write_dn($entry->dn,$self->{'encode'},$wrap);
_write_attrs($entry,$wrap,$lower);
}
@@ -494,6 +509,11 @@
sub current_lines {
my $self = shift;
$self->{_current_lines};
+}
+
+sub version {
+ my $self = shift;
+ $self->{version};
}
sub next_lines {
|