On Fri, 2008-09-19 at 06:58 -0700, [EMAIL PROTECTED] wrote: > Hi > > When using read/sysread you pass variables like $fo->sysread($buf, > $buflen), and the data is returned in buf. > This is magic to me, normally you ought to call sysread like $fo- > >sysread(\$buf,$buflen), passing a reference/pointer to the buffer. > > Apparantly here's some trick, although the variable content is put on > the perl-stack, sysread can decode the reference to the variable. > > Looking at it from .xs perspective, you'd get something like > > int sysread //OK, this is pseudo xs code. > SV *buf, > SV *buflen > > CODE: > > and maybe one can get the reference (*buf) to the buf in this case. > > Is this how sysread does it? Is there a way to access \$buf from perl > (other than .xs) ?
You do it with a sub prototype; they're not the same thing as in C. See `perldoc perlsub` for details. -- Just my 0.00000002 million dollars worth, Shawn "Where there's duct tape, there's hope." Cross Time Cafe "Perl is the duct tape of the Internet." Hassan Schroeder, Sun's first webmaster "There is more than one way to do things." A Perl axiom -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/