perl-ldap
view release on metacpan or search on metacpan
contrib/ldifsort.pl view on Meta::CPAN
my $keyattr = $args{k};
my $sortattrs = $args{a};
my $ciscmp = $args{c};
my $ldiffile = $ARGV[0];
my $sorthier = $args{h};
die "usage: $0 -k keyattr [-acdhn] ldiffile\n"
unless $keyattr && $ldiffile;
$/ = "";
open(LDIFH, $ldiffile) || die "$ldiffile: $!\n";
my $pos = 0;
my @valuepos;
while (<LDIFH>) {
my $value;
1 while s/^($keyattr:.*)?\n /$1/im; # Handle line continuations
if (/^$keyattr(::?) (.*)$/im) {
$value = $2;
contrib/ldifuniq.pl view on Meta::CPAN
use MIME::Base64;
use strict;
my $reffile = $ARGV[0];
my $cmpfile = $ARGV[1];
die "usage: $0 reffile cmpfile\n" unless $reffile && $cmpfile;
$/ = "";
sub getdn {
my $rec = shift;
my $dn;
1 while s/^(dn:.*)?\n /$1/im; # Handle line continuations
if (/^dn(::?) (.*)$/im) {
$dn = $2;
$dn = decode_base64($dn) if $1 eq '::';
lib/Net/LDAP/Constant.pm view on Meta::CPAN
$err2name[$code] || sprintf('LDAP error code %d(0x%02X)', $code, $code);
}
sub Net::LDAP::Util::ldap_error_text {
my $code = 0 + (ref($_[0]) ? $_[0]->code : $_[0]);
my $text;
seek(DATA, 0, 0);
local $/=''; # paragraph mode
local $_;
my $n = -1;
while (<DATA>) {
last if /^=head2/ and ++$n;
last if /^=cut/;
next if $n;
if (/^=item\s+(LDAP_\S+)\s+\((\d+)\)/) {
last if defined $text;
$text = '' if $2 == $code;
}
t/02filter.t view on Meta::CPAN
#!perl
# Testcase contributed by Julian Onions <Julian.Onions@nexor.co.uk>
use Test::More;
use Net::LDAP::Filter;
use Net::LDAP::ASN qw(Filter);
use Convert::ASN1 qw(asn_dump);
my $asn = $Filter;
my @tests = do { local $/=""; <DATA> };
plan tests => 4 * scalar(@tests);
my $testno = 0;
my $test;
foreach $test (@tests) {
my ($filter, $ber, $filter_out) = $test =~ /^
(?:\#.*\n)*
(.*)\n
t/71preread.t view on Meta::CPAN
use Net::LDAP;
use Net::LDAP::Constant qw(LDAP_CONTROL_PREREAD);
use Net::LDAP::Control::PreRead;
BEGIN { require "t/common.pl" }
my @tests;
{ # parse DATA into a list (= tests) of hashes (= test parameters) of lists (= parameter values)
local $/ = '';
while(my $para = <DATA> ) {
my @lines = split(/\n/, $para);
my %params;
chomp(@lines);
@lines = grep(!/^\s*(?:#.*?)?$/, @lines);
map { push(@{$params{$1}}, $2) if (/^(\w+):\s*(.*)$/) } @lines;
push(@tests, \%params) if (%params);
}
}
t/72postread.t view on Meta::CPAN
use Net::LDAP;
use Net::LDAP::Constant qw(LDAP_CONTROL_POSTREAD);
use Net::LDAP::Control::PostRead;
BEGIN { require "t/common.pl" }
my @tests;
{ # parse DATA into a list (= tests) of hashes (= test parameters) of lists (= parameter values)
local $/ = '';
while(my $para = <DATA> ) {
my @lines = split(/\n/, $para);
my %params;
chomp(@lines);
@lines = grep(!/^\s*(?:#.*?)?$/, @lines);
map { push(@{$params{$1}}, $2) if (/^(\w+):\s*(.*)$/) } @lines;
push(@tests, \%params) if (%params);
}
}
t/73assert.t view on Meta::CPAN
use Net::LDAP;
use Net::LDAP::Constant qw(LDAP_CONTROL_ASSERTION);
use Net::LDAP::Control::Assertion;
BEGIN { require "t/common.pl" }
my @tests;
{ # parse DATA into a list (= tests) of hashes (= test parameters) of lists (= parameter values)
local $/ = '';
while(my $para = <DATA> ) {
my @lines = split(/\n/, $para);
my %params;
chomp(@lines);
@lines = grep(!/^\s*(?:#.*?)?$/, @lines);
map { push(@{$params{$1}}, $2) if (/^(\w+):\s*(.*)$/) } @lines;
push(@tests, \%params) if (%params);
}
}
t/74matchedvalues.t view on Meta::CPAN
use Net::LDAP;
use Net::LDAP::Constant qw(LDAP_CONTROL_MATCHEDVALUES);
use Net::LDAP::Control::MatchedValues;
BEGIN { require "t/common.pl" }
my @tests;
{ # parse DATA into a list (= tests) of hashes (= test parameters) of lists (= parameter values)
local $/ = '';
while(my $para = <DATA> ) {
my @lines = split(/\n/, $para);
my %params;
chomp(@lines);
@lines = grep(!/^\s*(?:#.*?)?$/, @lines);
map { push(@{$params{$1}}, $2) if (/^(\w+):\s*(.*)$/) } @lines;
push(@tests, \%params) if (%params);
}
}
( run in 0.635 second using v1.01-cache-2.11-cpan-49f99fa48dc )