in reply to Help with XS and anonymous arrays
Either make a copy of the array that was passed to new or simply increase its reference count. Otherwise perl tries to free it, as you see. That doesn't happen if you pass a named reference because the array is still in the same scope and won't get destroyed therefor.
For example it should also work with with an anonymous reference if you store it in another lexical variable:
my @array = 1 .. 3; my $ref = [@array] Test->new($ref);
Cheers, Flo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help with XS and anonymous arrays
by Anonymous Monk on Mar 29, 2006 at 00:17 UTC | |
by rafl (Friar) on Mar 29, 2006 at 00:26 UTC |