[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SSL trouble



In message <[email protected]>, "Josh M. Osborne" wri
tes:
[...]
>sub syswrite {
[...]

So sorry.  I gave out the wrong code.  Let me try again:

sub sysreadln {
    local($FH) = @_;

    local($len, $line, $offset) = (0, "", 0);
    
    while("\n" ne substr($line, $offset-1, 1)) {
        $len = sysread($FH, $line, 1, $offset);
        die "Bad read from $FH: $!" if (!defined($len));
        $offset += $len;
    }

    return $line;
}

There.  That should help.

(yes, this is slow since it asks the OS for a single byte at a time,
but in practice it isn't too bad - I use it for small tasks and my
multi-stream state-machine monster for the rest)