in reply to how to goto &sysread ?
You cannot "go to" a function x(), because there would be no way to return from the function. Part of a statement like: func_x(); is setting up the stack to call func_x() so that when func_x finishes, it returns to the caller. A "go to" would skip all that stuff that enables the function to return to the caller.
Describe in words what you are trying to do.
Update: this code example, while correct is not illustrative of the OP's problem.
sysread() would be used for say reading a socket with fixed size user level packets. When we read the socket, we learn how many bytes were actually read and we loop if we need more. "Go to sysread() makes no sense".
sub readn #returns scalar with <= $bytes requested { my ($socket, $bytes ) = @_; my $offset = 0; my $buf = ""; my $nread = -1; while ($offset < $bytes and $nread) # $nread==0 means EOF { my $nleft = $bytes-$offset; $nread = sysread($socket, $buf, $nleft, $offset); $offset += $nread; } return $buf; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to goto &sysread ?
by davido (Cardinal) on Jul 25, 2011 at 06:10 UTC | |
|
Re^2: how to goto &sysread ?
by perl5ever (Pilgrim) on Jul 25, 2011 at 05:19 UTC | |
by ikegami (Patriarch) on Jul 25, 2011 at 05:31 UTC | |
by Marshall (Canon) on Jul 25, 2011 at 05:39 UTC | |
by ikegami (Patriarch) on Jul 25, 2011 at 06:16 UTC | |
by Marshall (Canon) on Jul 25, 2011 at 06:39 UTC | |
by Tanktalus (Canon) on Jul 26, 2011 at 14:06 UTC |