Thks,

Your first solution help me, I do a hash from anonymous array, then I modified 
and return to a anonymous array and ldapadd works well.

thsks.

LD

El Mar 10 Ago 2004 07:12, Ramprasad A Padmanabhan escribió:
> Luis Daniel Lucio Quiroz wrote:
> >You are wrong,
> >
> >I need some more flexible,
> >
> >I dont know what attributes will be added, that's why I need array be
> > coded on fly,    with somthin like this
> >
> >$result = $ldap->add( 'cn=Barbara Jensen, o=University of Michigan,
> > c=US', attr =>$attrs);
> >
> >so $attrs array is formed on user commands
> >
> >:-P
> >
> >LD
>
> Luis, You still dont have to access the object directly.
> if $attrs is an object created from the users input , so be it.
>
> #Create a hash array of all user inputs. say
> %hash = get_user_input();
>
> # Have an array of all possible optional fields like
> @ALL_FIELDS =  qw ( mail l ou o .....) ;
>
> # Create your attrs array
> $attrs = {};
> foreach (@ALL_FIELDS ) {
>    if($hash{$_}) {
>     $$attrs{$_}  = $hash{$_};   # Just make sure your input is trimmed
> for leading spaces  and lagging spaces or remove them here
>   }
> }
>
> # Now  add this to your ldap entries
>
> $result = $ldap->add( $dn, attr =>$attrs);
>
>
> IMHO that is simpler than poking at the structure and neater
>
> HTH
> Ram

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to