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

El Lun 09 Ago 2004 10:35, Chris Devers escribió:
> On Mon, 9 Aug 2004, Luis Daniel Lucio Quiroz wrote:
> > Yes I do,  I need array not to be hard-coded
>
> So don't hard-code it then.
>
> Just modify the update command the library provides so that it does what
> you need it to do.
>
> Manually poking at the data structure that a library uses internally is
> a BAD idea; it breaks the whole point of using object-oriented methods.
>
> So. You want to change how you do an update. So take this --
>
> >>      $result = $ldap->add( 'cn=Barbara Jensen, o=University of Michigan,
> >> c=US', attr => [ 'cn'   => ['Barbara Jensen', 'Barbs Jensen'], 'sn'   =>
> >> 'Jensen',
> >>                              'mail' => '[EMAIL PROTECTED]',
> >>                              'objectclass' => ['top', 'person',
> >>                                                'organizationalPerson',
> >>                                                'inetOrgPerson' ],
> >>                            ]
> >>                          );
> >>
> >>      $result->code && warn "failed to add entry: ", $result->error ;
>
> And edit the fields you need to have added.
>
>    $result = $ldap->add(
>        'cn'   => ['George Kaplan', 'Roger Thornhill'],
>        'mail' => '[EMAIL PROTECTED]'
>    );
>    $result->code && warn "failed to add entry: ", $result-error;
>
>    $result = $ldap->add( 'cn' => ["$name", "$nick"], 'mail' => "$mail" );
>    $result->code && warn "failed to add $name/$mail: ", $result-error;
>
> In what way isn't this working for you?
>
>
> If you try to poke at the data structure Net::LDAP is using without
> going through the $ldap->add() method provided, you're probably going to
> regret it in the long run, when -- as inevitably happens -- some random
> update changes how things are stored but not the API and your code that
> depended on the old storage mechanism falls apart with the new one. If
> on the other hand you just use the normal API, you should be safe.
>
>
>
> --
> Chris Devers

--
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