Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Generating complex LDAP queries with Perl

by grinder (Bishop)
on Jul 18, 2009 at 09:34 UTC ( #781286=note: print w/ replies, xml ) Need Help??


in reply to Re: Generating complex LDAP queries with Perl
in thread Generating complex LDAP queries with Perl

Just to situate the historical context, I added the if defined $cond much later on in the piece, when I added the IGNORE() function to change an AND() or an OR() into a no-op.

The idea was to ensure that "valid1", "valid2", undef, "valid3" produces a syntactically correct query, without a fourth half-baked conditional creeping in there.

But you know what? You're absolutely correct. Given the above and the following:

sub _joiner { my $op = shift; my $filter = shift; while (my $cond = shift) { $filter = "($op $filter $cond)"; } return $filter; } my $filter = AND( "(a=1)", IGNORE( "(b=1)", "(b=2)", ), "(c=1)", );

It does indeed produce (& (a=1) (c=1)). Thank-you very much for this insight, I appreciate it.

• another intruder with the mooring in the heart of the Perl


Comment on Re^2: Generating complex LDAP queries with Perl
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://781286]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2015-07-06 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls