The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SPVM::IO::Handle - I/O Handling

Description

SPVM::IO::Handle is the SPVM's IO::Handle class for I/O handling.

Usage

  use IO::Handle;
  my $handle = IO::Handle->new;
  $handle->set_autoflush(1);

Instance Methods

Fields

fd

  has fd : protected int;

A file descriptor.

autoflush

  has autoflush : rw byte;

opened

  has opened : ro protected int;

Blocking

  has Blocking : rw protected int;
  

Class methods

new

  static method new : IO::Handle ($options : object[]);

Instance Methods

init

  method init : void ($options : object[] = undef);

opened

  method opened : int ();

If the return value of "fileno" is greater than or equal to 0, returns 1. Otherwise returns 0.

fileno

  method fileno : int ();

Gets "fh" field.

print

  method print : void ($string : string);

printf

  method printf : void ($format : string, $args : object[]...);

say

  method say : void ($string : string);

truncate

  method truncate : void ($legnth : long);

Truncates to a size of precisely length bytes.

This method is planed to be implemented in a child class.

This method always throws an exception.

ioctl

  static method ioctl : int ($fd : int, $request : int, $request_arg_ref : object of byte[]|short[]|int[]|long[]|float[]|double[]|object = undef);

sync

  method sync : void ();

stat

  method stat : Sys::IO::Stat ();

fcntl

  method fcntl : int ($command : int, $command_arg : object = undef of Int|Sys::IO::Flock|object);

set_blocking

  method set_blocking : void ($blocking : int);

syswrite

  method syswrite : int ($string : string, $length : int = -1, $offset : int = 0) {

sysread

  method sysread : int ($string : mutable string, $length : int = -1, $offset : int = 0) {

write

  method write : int ($string : string, $length : int = -1, $offset : int = 0);

Exceptions:

Not implemented.

read

  method read : int ($string : mutable string, $length : int = -1, $offset : int = 0);

Exceptions:

Not implemented.

close

  method close : int ();

Exceptions:

Not implemented.

Well Known Child Classes

IO::File

IO::File

IO::Socket

IO::Socket

IO::Socket::INET

IO::Socket::INET

See Also

IO::Handle

SPVM::IO::Handle is the Perl's IO::Handle porting to SPVM.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License