SPVM::Sys - System Calls for File IO, User, Process, Signal, Socket
SPVM::Sys is the Sys class in SPVM language. It provides system calls such as file IO, user manipulation, process, socket, time,
SPVM::Sys
Sys
This class provides methods compatible with functions related to system calls provided by Perl.
This distribution contains many modules for system calls such as Sys::IO, Sys::Socket, Sys::Process. See "Modules".
Methods compatible with file IO, sockets, file paths, current directory, select, and poll are implemented as other modules such as IO::File, IO::Socket, Cwd. See "See Also".
use Sys; Sys->mkdir("foo"); Sys->rmdir("foo"); my $path = Sys->env("PATH"); my $process_id = Sys->getpid;
static method env : string ($name : string);
Gets an environment variable. The same as getting of the Perl $ENV{$name}.
static method osname : string ()
Gets OS name. The same as Perl $^O.
Currently the following OS names are supported.
linux
darwin
MSWin32
freebsd
openbsd
solaris
static method A : double ($file : string);
Script start time minus file access time, in days. The same as Perl -A.
static method C : double ($file : string);
Script start time minus file inode change time, in days. The same as Perl -C.
static method M : double ($file : string);
Script start time minus file modification time, in days. The same as Perl -M.
static method O : int ($file : string);
File is owned by real uid. The same as Perl -O.
static method R : int ($file : string);
File is readable by real uid/gid. The same as Perl -R.
static method S : int ($file : string);
File is a socket. The same as Perl -S.
static method W : int ($file : string);
File is writable by real uid/gid. The same as Perl -W.
static method X : int ($file : string);
File is executable by real uid/gid. The same as Perl -X.
static method b : int ($file : string);
File is a block special file. The same as Perl -b.
static method c : int ($file : string);
File is a character special file. The same as Perl -c.
static method d : int ($file : string);
File is a directory. The same as Perl -d.
static method e : int ($file : string);
File exists. The same as Perl -e.
static method f : int ($file : string);
File is a plain file. The same as Perl -f.
static method g : int ($file : string);
File has setgid bit set. The same as Perl -g.
static method k : int ($file : string);
File has sticky bit set. The same as Perl -k.
static method l : int ($file : string);
File is a symbolic link (false if symlinks aren't supported by the file system). The same as Perl -l.
static method o : int ($file : string);
File is owned by effective uid. The same as Perl -l.
static method p : int ($file : string);
File is a named pipe (FIFO), or Filehandle is a pipe. The same as Perl -p.
static method r : int ($file : string);
File is readable by effective uid/gid. The same as Perl -r.
static method s : long ($file : string);
File has nonzero size (returns size in bytes). The same as Perl -s.
static method u : int ($file : string);
File has setuid bit set. The same as Perl -u.
static method w : int ($file : string);
File is writable by effective uid/gid. The same as Perl -u.
static method x : int ($file : string);
File is executable by effective uid/gid. The same as Perl -x.
static method z : int ($file : string);
File has zero size (is empty). The same as Perl -z.
static method time : long ();
Returns the number of non-leap seconds since whatever time the system considers to be the epoch, suitable for feeding to gmtime and localtime. The same as the Perl time. This is the alias for time method in the Time class.
static method localtime : Time::Info ($time : long);
Converts a time as returned by the time function to a Time::Info object with the time analyzed for the local time zone. The same as the Perl localtime. This is the alias for localtime method in the Time class.
static method gmtime : Time::Info ($time : long);
Works just like localtime, but the returned values are localized for the standard Greenwich time zone. The same as the Perl gmtime. This is the alias for gmtime method in the Time class.
static method process_id : int ();
Gets the process number of the running this program. The same as the Perl $$.
static method stat : Sys::IO::Stat ($path : string);
Returns a Sys::IO::Stat object giving the status info for a file. The same as the Perl stat function.
static method chdir : int ($path : string);
Changes the working directory to $path. The same as the Perl chdir function.
static method chmod : int ($mode :int, $path : string);
Changes the permissions of a file. The same as the Perl chmod function.
static method mkdir : int ($path : string, $mode : int);
Creates the directory specified by $path and $mode. The same as the Perl mkdir function.
static method umask : int ($mode : int);
Sets the umask for the process to $mode and returns the previous value. The same as the Perl umask function.
static method rmdir : int ($path : string);
Deletes the directory specified by $path. The same as the Perl rmdir function.
static method unlink : int ($pathname : string);
Deletes a file. The same as the Perl unlink function.
static method rename : int ($oldpath : string, $newpath : string);
Changes the name of a file. The same as the Perl rename function.
static method readlink : int ($file : string);
Returns the value of a symbolic link. The same as the Perl readlink function.
static method symlink : int ($oldpath : string, $newpath : string);
Creates a $newpath symbolically linked to the $oldpath. The same as the Perl symlink function.
static method sleep : int ($seconds : int);
Causes the program to sleep for $seconds seconds. The same as the Perl sleep.
All modules included in this distribution. These classes have methods that directly correspond to Linux/Unix/Mac or Windows system call functions written in C. In addition, several helper methods are implemented.
Yuki Kimoto(https://github.com/yuki-kimoto)
Gabor Szabo(https://github.com/szabgab)
SPVM::Sys - Github
Copyright Yuki Kimoto 2022-2023, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install SPVM::Sys, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SPVM::Sys
CPAN shell
perl -MCPAN -e shell install SPVM::Sys
For more information on module installation, please visit the detailed CPAN module installation guide.