cosimo/perl5-win32-api — pull request #2 by el1n (2012-07-23 08:58:14+00:00)
Title: update for the structure array and the array of 2bytes or more.

sorry, my english is bad.
so i want to tell in code.

version <= 0.68 is not works this structure.
```
Win32::API::Struct->typedef(qw(
ST1
LONG a[4];
));
Win32::API::Struct->typedef(qw(
ST2
LONG a;
));
Win32::API::Struct->typedef(qw(
ST3
ST1 a[4];
));
my $st1 = Win32::API::Struct->new(ST1);
my $st3 = Win32::API::Struct->new(ST3);
printf("st1->sizeof=%d\n",$st1->sizeof());
printf("st3->sizeof=%d\n",$st3->sizeof());
my $buf = pack("l16",(0x21212121) x 16);
$st1->FromMemory(unpack("L",pack("p",$buf)));
print Data::Dumper::Dumper($st1);
$st3->FromMemory(unpack("L",pack("p",$buf)));
print Data::Dumper::Dumper($st3);
```
output:
```
st1->sizeof=16
st3->sizeof=16
$VAR1 = bless( {
'__typedef__' => 'ST1',
'a' => '!!!!',
'buffer_recipients' => [
$VAR1
],
'typedef' => [
[
'a',
'l*4',
'LONG'
]
],
'buffer' => '!!!!!!!!!!!!!!!!'
}, 'Win32::API::Struct' );
$VAR1 = bless( {
'__typedef__' => 'ST3',
'buffer_recipients' => [
bless( {
'__typedef__' => 'ST1',
'a' => '!!!!',
'typedef' => [
[
'a',
'l*4',
'LONG'
]
]
}, 'Win32::API::Struct' )
],
'typedef' => [
[
'a[4]',
'>',
'ST1'
]
],
'buffer' => '!!!!!!!!!!!!!!!!',
'a[4]' => $VAR1->{'buffer_recipients'}[0]
}, 'Win32::API::Struct' );
```

i changed 0.68 to 0.69
0.69 output is...
```
st1->sizeof=16
st3->sizeof=64
$VAR1 = bless( {
'__typedef__' => 'ST1',
'a' => [
555819297,
555819297,
555819297,
555819297
],
'buffer_recipients' => [
$VAR1,
$VAR1,
$VAR1,
$VAR1
],
'typedef' => [
[
'a',
'l*4',
'LONG'
]
],
'buffer' => '!!!!!!!!!!!!!!!!'
}, 'Win32::API::Struct' );
$VAR1 = bless( {
'__typedef__' => 'ST3',
'a' => [
bless( {
'__typedef__' => 'ST1',
'a' => [
555819297,
555819297,
555819297,
555819297
],
'typedef' => [
[
'a',
'l*4',
'LONG'
]
]
}, 'Win32::API::Struct' ),
bless( {
'__typedef__' => 'ST1',
'a' => [
555819297,
555819297,
555819297,
555819297
],
'typedef' => $VAR1->{'a'}[0]{'typedef'}
}, 'Win32::API::Struct' ),
bless( {
'__typedef__' => 'ST1',
'a' => [
555819297,
555819297,
555819297,
555819297
],
'typedef' => $VAR1->{'a'}[0]{'typedef'}
}, 'Win32::API::Struct' ),
bless( {
'__typedef__' => 'ST1',
'a' => [
555819297,
555819297,
555819297,
555819297
],
'typedef' => $VAR1->{'a'}[0]{'typedef'}
}, 'Win32::API::Struct' )
],
'buffer_recipients' => [
$VAR1->{'a'}[0],
$VAR1->{'a'}[0],
$VAR1->{'a'}[0],
$VAR1->{'a'}[0],
$VAR1->{'a'}[1],
$VAR1->{'a'}[1],
$VAR1->{'a'}[1],
$VAR1->{'a'}[1],
$VAR1->{'a'}[2],
$VAR1->{'a'}[2],
$VAR1->{'a'}[2],
$VAR1->{'a'}[2],
$VAR1->{'a'}[3],
$VAR1->{'a'}[3],
$VAR1->{'a'}[3],
$VAR1->{'a'}[3]
],
'typedef' => [
[
'a',
'>*4',
'ST1'
]
],
'buffer' => '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
}, 'Win32::API::Struct' );
```

thanks