in reply to Re^8: Net::LDAP help with distinguished name
in thread Net::LDAP help with distinguished name
The idiom of that function is
{ my %subs = ( '\\' => q/\\5c/, '(' => q/\\28/, ')' => q/\\29/, '&' => q/\\26/, '|' => q/\\7c/, '>' => q/\\3e/, '<' => q/\\3c/, '~' => q/\\7e/, '*' => q/\\2a/, ); my $subs_re = join '|', map quotemeta, key %subs; sub cleanLDAPString { my $tempstr = shift; $tempstr =~ s/($subs_re)/$subs{$1}/g; return $tempstr; } }
But it already exists http://search.cpan.org/grep?cpanid=MARSCHAP&release=perl-ldap-0.44&string=escape&i=1&n=1&C=0 in Net::LDAP::Util
escape_filter_value ( VALUES ) unescape_filter_value ( VALUES ) escape_dn_value ( VALUES ) unescape_dn_value ( VALUES )
|
---|