Subject: | Make DBD::LDAP work with Class::DBI and a Netscape LDAP server (JLdap.pm patch) |
This patch contains:
- some dereferencing of some references (mostly in "wantarray"-constructs
- more code consistency ( if @{$var} is used once in the code, use it everywhere .. and not @$var or ($var) )
- more case insenstive matching and substitutes.
This patch was tested on a OpenLDAP server but was mostly created to make DBD::LDAP work correctly with Class::DBI and with a Netscape LDAP server.
If you want the patch differently or more information, feedback.. don't hestitate to mail me.
--- my_version/JLdap.pm 2005-04-13 13:58:15.241964392 +0200
+++ installed_version/JLdap.pm 2005-04-13 13:55:52.120722128 +0200
@@ -111,7 +111,7 @@
}
else
{ #SQL RETURNED OK.
- return wantarray ? @$status : $status;
+ return wantarray ? ($status) : $status;
}
}
}
@@ -163,8 +163,8 @@
$descorder = ($ordercols[$#ordercols] =~ s/(\w+\W+)desc(?:end|ending)?$/$1/i); #MODIFIED 20000721 TO ALLOW "desc|descend|descending"!
for $i (0..$#ordercols)
{
- $ordercols[$i] =~ s/\s//ig;
- $ordercols[$i] =~ s/[\(\)]+//ig;
+ $ordercols[$i] =~ s/\s//g;
+ $ordercols[$i] =~ s/[\(\)]+//g;
}
}
$tablehash = $dbh->FETCH('ldap_tables');
@@ -216,8 +216,7 @@
while (my $entry = $data->shift_entry())
{
$dn = $entry->dn();
-
- next unless ($dn =~ /$base$/i);
+ next unless ($dn =~ /$base$/);
@attributes = $entry->attributes;
unless ($attbcnt)
{
@@ -245,7 +244,7 @@
}
else
{
- $varlist[$j][$fieldnamehash{$attr}] = join($self->{ldap_outseparator}, @{$valuesref}) || '';
+ $varlist[$j][$fieldnamehash{$attr}] = join($self->{ldap_outseparator}, @$valuesref) || '';
}
unless ($valuesref[0])
{
@@ -459,6 +458,7 @@
$s =~ s/^\s+//;
return unless ($s);
+
my $relop = '(?:<|=|>|<=|>=|!=|like|not\s+like|is\s+not|is)';
my %boolopsym = ('and' => '&', 'or' => '|');
@@ -469,7 +469,7 @@
my @QS = ();
$s=~s|\\\'|\x04|g; #PROTECT "\'" IN QUOTES.
- $s=~s|\\\"|\x02|g; #PROTECT "\"" IN QUOTES.
+ $s=~s|\\\"|\x02|g; #PROTECT "\"" IN QUOTES.
#THIS NEXT LOOP STRIPS OUT AND SAVES ALL QUOTED STRING LITERALS
#TO PREVENT THEM FROM INTERFEARING WITH OTHER REGICES, IE. DON'T
@@ -526,7 +526,7 @@
$QS[$qsindx] = '*' unless (length($QS[$qsindx]));
}
"\$P\[$indx]";
- /ei);
+ /e);
$tindx = 0;
$s = &parseParins($s);
@@ -546,7 +546,7 @@
}
$s =~ s/AND/and/ig;
$s =~ s/OR/or/ig;
- 1 while ($s =~ s/(.+?)\s*\band\b\s*(.+)/\(\&\($1\)\($2\)\)/i);
+ 1 while ($s =~ s/(.+?)\s*\band\b\s*(.+)/\(\&\($1\)\($2\)\)/);
@l = ();
@l = split(/\s*\bor\b\s*/i, $s);
if ($#l > 0)