Name

SPVM::Sys::Env - Environemnt Variable

Description

SPVM::Sys::Env is the Sys::Env class in SPVM language. It provides system calls for environemnt variables.

Usage

use Sys::Env;

my $path = Sys::Env->getenv("PATH");

Class Methods

getenv

static method getenv : string ($name : string);

The getenv() function searches the environment list to find the environment variable name, and returns a pointer to the corresponding value string.

See the detail of the getenv function in the case of Linux.

setenv

static method setenv : int ($name : string, $value : string, $overwrite : int);

The setenv() function adds the variable name to the environment with the value value, if name does not already exist. If name does exist in the environment, then its value is changed to value if overwrite is nonzero; if overwrite is zero, then the value of name is not changed. This function makes copies of the strings pointed to by name and value (by contrast with putenv(3)).

See the detail of the setenv function in the case of Linux.

unsetenv

static method unsetenv : int ($name : string);

The unsetenv() function deletes the variable name from the environment. If name does not exist in the environment, then the function succeeds, and the environment is unchanged.

See the detail of the unsetenv function in the case of Linux.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License