Olivier CLERE wrote:
> Here is my Perl code:
> 
> %berval=  (
>   bv_len=>3,
>   bv_val=>"123",
>   );
> 
> $ldapctrl =    {
>  ldctl_oid=>"2.16.840.1.113730.3.4.2",
>  ldctl_iscritical=>1,
>  ldctl_value=> %berval,
>                     };

You probably want the last line to be

    ldctl_value => \%berval,

instead -- otherwise you should get a warning about an "odd number of
elements in hash assignment" since the hash would be flattened out into a
list (this ain't Python).

> I would like to define the Perl equivalent of
> what we would call in C:
> "an array of pointers to the structure ldapctrl",

In terms of data structures, the most idiomatic equivalent, in my opinion,
would be

   "an array of references to hashes"

. That the hashes contain as keys the keys of struct ldapctrl doesn't matter
to the reference (unless you decide to make up your own class, in which case
you can have "references to ldapctrl objects").

> tppldapctrl[0] = &ldapctrl;
> tppldapctrl[1] = NULL;
> tppldapctrl[2] = NULL;
> 
> tppldapctrl[3] is an array of pointer to structure
> LDAPcontrol. What would be the equivalent in Perl?

    $tppldapctrl[0] = $ldapctrl;
    $tppldapctrl[1] = undef;
    $tppldapctrl[2] = undef;

Since above, you declared $ldapctrl as a reference to a hash (you used
$ldapctrl = { ... } instead of %ldapctrl = ( ... )), you can just assign
this hashref to the first element of @tppldapctrl.

Cheers,
Philip

---
You are currently subscribed to perl-win32-users as: [archive@jab.org]
To unsubscribe, forward this message to
         [EMAIL PROTECTED]
For non-automated Mailing List support, send email to  
         [EMAIL PROTECTED]

Reply via email to