Name

SPVM::Go::UV - libuv Binding

Description

Go::UV class in SPVM is a libuv binding.

Usage

use Go::UV::Loop;
use Go::UV::Constant as UV_C;

my $uv_loop = Go::UV::Loop->new;

# Do someting

$uv_loop->run(UV_C->UV_RUN_DEFAULT);

Timer:

use Go::UV::Handle::Timer;

my $timeout_msec = 3_000;
my $uv_timer = Go::UV::Handle::Timer->new;
$uv_loop->timer_init($uv_timer);
my $timer_cb = method : void ($uv_timer : Go::UV::Handle::Timer) {
  
  # Do something
  
  $uv_timer->close;
};
$uv_timer->start($timer_cb, $timeout_msec);

Socket IO:

use Go::UV::Handle::Poll;

my $uv_poll = Go::UV::Handle::Poll->new;
$uv_loop->poll_init($uv_poll, $fd);
my $poll_cb = method : void ($uv_poll : Go::UV::Handle::Poll, $status : int, $events : int) {
  
  # Do something
  
  $poll_cb->close;
};

my $events = UV_C->UV_READABLE | UV_C->UV_WRITABLE;
$uv_poll->start($poll_cb, $events);

Class Methods

strerror

static method strerror : string ($status : int);

Gets human-readable description for an error code by calling uv_strerror_r, and returns it as a string.

Modules

Repository

Author

Yuki Kimoto kimoto.yuki@gmail.com

Copyright & License

Copyright (c) 2026 Yuki Kimoto

MIT License