Name

SPVM::Go::UV::Request::Write - Write Request for libuv

Description

Go::UV::Request::Write in SPVM represents the write request for libuv, corresponding to the uv_write_t structure.

Usage

use Go::UV::Request::Write;

my $req_write = Go::UV::Request::Write->new;

Super Class

Go::UV::Request.

Fields

write_cb

has write_cb : rw Go::UV::Callback::Write;

The callback called when the write request has completed.

write_buffer

has write_buffer : rw string;

The buffer associated with the write request.

Class Methods

new

static method new : Go::UV::Request::Write ();

Creates a new Go::UV::Request::Write object, and returns it.

Instance Methods

write

method write : void ($uv_stream : Go::UV::Handle::Stream, $buffer : string, $buffer_length : int, $cb : Go::UV::Callback::Write, $buffer_offset : int = 0);

Writes data from $buffer with length $buffer_length and offset $buffer_offset to the stream $uv_stream.

The callback $cb is stored in "write_cb" field. The buffer $buffer is stored in "write_buffer" field.

The callback $cb is invoked when the write operation completes.

Exceptions:

If $uv_stream is not defined, an exception is thrown.

If $buffer is not defined, an exception is thrown.

If $buffer_length is not a positive number, an exception is thrown.

If $buffer_offset + $buffer_length is greater than the length of $buffer, an exception is thrown.

If $cb is not defined, an exception is thrown.

If uv_write fails, an exception is thrown.

Copyright & License

Copyright (c) 2026 Yuki Kimoto

MIT License