swig/Examples/test-suite/perl5/li_cdata_carrays_runme.pl
Olly Betts e2d7f303b8 [perl5] Use sv_setpvn() to set a scalar from a pointer and length
- patch from SF#174460 by "matsubaray".


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9937 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-09-17 23:24:11 +00:00

11 lines
229 B
Perl

use li_cdata_carrays;
$a = li_cdata_carrays::intArray->new(5);
for (0..4) {
$a->setitem($_, $_**2);
}
$x = pack q{I5}, map $_**2, (0..4);
$y = li_cdata_carrays::cdata_int($a->cast, 5);
if ( $x ne $y ) {
die "$x vs $y";
}