On Wed, Jun 8, 2011 at 7:11 PM, NormW <no...@gknw.net> wrote:
> AFAICT, I want to implement the following Perl call to XS code:
>
> my (@ro,@wo,@eo) = nw_select(\@ri,\@wi,\@ei,$wait);

Perhaps you meant:

my ($ro, $wo, $eo) = nw_select(\@ri, \@wi, \@ei, $wait);

That is, instead of getting three arrays returned, getting three array
/references/ returned. The first is valid Perl, but it probably
doesn't do what you intended since the first array would get all of
the values returned by nw_select and the second two arrays would
always be empty.

bash $ perl -e <<'EOF'
use strict;
use warnings;

use Data::Dumper;

sub example
{
    my @first = (1..3);
    my @second = (4..6);
    my @third = (7..9);

    return @first, @second, @third;
}

my (@first, @second, @third) = example;

print Dumper \@first, \@second, \@third;
EOF
$VAR1 = [
          1,
          2,
          3,
          4,
          5,
          6,
          7,
          8,
          9
        ];
$VAR2 = [];
$VAR3 = [];
bash $

See `perldoc perlsub` for details.

I'm afraid that I'm lurking here to try to learn XS by example so I
can't help with the XS implementation. :) Good luck.


-- 
Brandon McCaig <http://www.bamccaig.com/> <bamcc...@gmail.com>
V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl.
Castopulence Software <http://www.castopulence.org/> <bamcc...@castopulence.org>

Reply via email to