Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

57 lines (41 sloc) 1.132 kB
#!perl
BEGIN {
require "t/common.pl";
}
unless (eval { require XML::SAX::Base; 1}) {
print "1..0 # XML::SAX::Base not installed\n";
exit;
}
unless (eval { require XML::SAX::Writer; 1}) {
print "1..0 # XML::SAX::Writer not installed\n";
exit;
}
require Net::LDAP::LDIF;
require Net::LDAP::DSML;
print "1..1\n";
my $infile = "data/00-in.ldif";
my $outfile1 = "$TEMPDIR/05-out1.dsml";
my $cmpfile1 = "data/05-cmp.dsml";
my $ldif = Net::LDAP::LDIF->new($infile,"r");
@entry = $ldif->read;
open(FH,">$outfile1");
binmode FH;
my $dsml = Net::LDAP::DSML->new(output => \*FH,pretty_print => 1);
$dsml->write_entry($_) for @entry;
$dsml->end_dsml;
close(FH);
# postprocess generated DSML file for more flexible comparison
# (don't rely on unpatched XML::SAX::Writer [e.g. Debian])
{
open(FH, "+<$outfile1");
binmode FH;
local $/; # slurp mode
my $txt = <FH>;
$txt =~ s/>\n[\n\t ]+/>\n/g; # remove empty lines & leading spaces after tags
$txt =~ s/\"/'/g; # convert " to ' in tag attribute values
seek(FH, 0, 0);
print FH $txt;
truncate(FH, length($txt));
close(FH);
}
ok(!compare($cmpfile1,$outfile1), $cmpfile1);
Jump to Line
Something went wrong with that request. Please try again.