That works, thanks.

-- 
Mark Drummond
Technical Specialist
STANTIVE Solutions Inc. - Kingston, ON, Canada
Sun Microsystems Independent Sales Organization (ISO)

T] 613.634.7410 ext.226   E] [EMAIL PROTECTED]
F] 613.634.7412           W] www.stantive.com


----- Original Message -----
From: Graham Barr <[EMAIL PROTECTED]>
Date: Wednesday, August 18, 2004 10:33 am
Subject: Re: "has value" functionality

> 
> On 18 Aug 2004, at 14:55, Mark Drummond wrote:
> 
> > Hi all. I am having trouble trying to figure out how to code 
> some sort 
> > of "has value" functionality. Specifically, I have a script 
> which will 
> > walk a DIT, adding a few objectclasses and attributes if those 
> are not 
> > already present. I am looking for a way to say "if this 
> objectclass 
> > does not exits, then add it". Is there some way to say "if 
> > $entry->get_values('objectclass') does not contain "foo", then 
> add 
> > foo"?
> 
> how about
> 
>   unless ( grep { $_ eq "foo" } $entry-
> >get_values('objectclass')) {
>     ...
>   }
> 
> Graham.
> 
> 

Reply via email to