I
Ivan Shmakov
I'm implementing a sysread () look-alike in XS:
my $result;
my $status
= $myio->myread ($start, $count, RESULT);
I wonder whether it's sensible to pass a scalar for RESULT (IOW,
$result), or should I use a reference instead (\$result)?
The issue with passing a scalar is that it won't (AIUI) be all
that easy to allow for "filter" or "guard" functions at the Perl
side, e. g.:
our $myio;
sub read_from_0 {
my $r
= $myio->myread (0, @_);
die (error_message ($r))
unless ($r == 0);
}
my $result;
read_from_0 ($count, $result);
Somehow, it seems that @_[1] in read_from_0 () won't be the same
scalar as the caller's $result. (While for \$result, it would
still be a /reference/ to the same scalar.)
Anything else I should consider?
TIA.
my $result;
my $status
= $myio->myread ($start, $count, RESULT);
I wonder whether it's sensible to pass a scalar for RESULT (IOW,
$result), or should I use a reference instead (\$result)?
The issue with passing a scalar is that it won't (AIUI) be all
that easy to allow for "filter" or "guard" functions at the Perl
side, e. g.:
our $myio;
sub read_from_0 {
my $r
= $myio->myread (0, @_);
die (error_message ($r))
unless ($r == 0);
}
my $result;
read_from_0 ($count, $result);
Somehow, it seems that @_[1] in read_from_0 () won't be the same
scalar as the caller's $result. (While for \$result, it would
still be a /reference/ to the same scalar.)
Anything else I should consider?
TIA.