Name
SPVM::File::Spec::Instance::Unix - Implementation of File::Spec::Instance for Unix-like OSs
Description
File::Spec::Instance::Unix class in SPVM is an implementation of File::Spec::Instance for Unix-like OSs such as Unix, Linux and Mac.
Usage
use File::Spec::Instance::Unix;
my $spec = File::Spec::Instance::Unix->new;
my $file = $spec->catfile(["foo", "bar", "a.txt"]);
Super Class
Class Methods
new
static method new : File::Spec::Instance::Unix ();
>
Creates a new File::Spec::Instance::Unix object, and returns it.
Instance Methods
canonpath
method canonpath : string ($path : string);
Returns a logical cleanup of a path from the path $path.
See "canonpath" in File::Spec::Unix for details.
catdir
method catdir : string ($parts : string[]);
Concatenates two or more directory names $parts to form a complete path ending with a directory, and returns it.
See "catdir" in File::Spec::Unix for details.
catfile
method catfile : string ($parts : string[]);
Concatenate one or more directory names and a filename $parts to form a complete path ending with a filename, and returns it.
See "catfile" in File::Spec::Unix for details.
curdir
method curdir : string ();
Returns a string representation of the current directory. "." on UNIX.
See "curdir" in File::Spec::Unix for details.
devnull
method devnull : string ();
Returns a string representation of the null device. "/dev/null" on UNIX.
See "devnull" in File::Spec::Unix for details.
rootdir
method rootdir : string ();
Returns a string representation of the root directory. "/" on UNIX.
See "rootdir" in File::Spec::Unix for details.
tmpdir
method tmpdir : string ();
Returns a string representation of the first writable directory from the following list or the current directory if none from the list are writable
See "tmpdir" in File::Spec::Unix for details.
updir
method updir : string ();
Returns a string representation of the parent directory. ".." on UNIX.
See "updir" in File::Spec::Unix for details.
no_upwards
method no_upwards : string[] ($parts : string[]);
Given a list of file names $parts, strip out those that refer to a parent directory, and returns them as an array. (Does not strip symlinks, only '.', '..', and equivalents.)
See "no_upwards" in File::Spec::Unix for details.
file_name_is_absolute
method file_name_is_absolute : int ($path : string);
Takes as argument a path $path and returns 1 if it is an absolute path. Otherwise returns 0.
See "file_name_is_absolute" in File::Spec::Unix for details.
path
method path : string[] ();
Returns the environment variable PATH
as a array.
See "path" in File::Spec::Unix for details.
join
method join : string ($parts : string[]);
The same as "catfile" method.
See "join" in File::Spec::Unix for details.
splitpath
method splitpath : string[] ($path : string, $no_file : int = 0);
Splits a path $path into volume, directory, and filename portions, and returns them as an array.
See "splitpath" in File::Spec::Unix for details.
splitdir
method splitdir : string[] ($path : string);
Splits the path $path to directory portions, and return them as an array.
See "splitdir" in File::Spec::Unix for details.
catpath
method catpath : string ($volume : string, $dir : string, $file : string);
Takes volume $volume, directory $dir and file $file portions and returns an entire path.
See "catpath" in File::Spec::Unix for details.
abs2rel
method abs2rel : string ($path : string, $base : string = undef);
Takes a destination path $path and an optional base path $base returns a relative path from the base path to the destination path.
See "abs2rel" in File::Spec::Unix for details.
rel2abs
method rel2abs : string ($path : string, $base : string = undef);
Converts a relative path to an absolute path $path and an optional base path $base, and returns it.
See "rel2abs" in File::Spec::Unix for details.
Copyright & License
Copyright (c) 2023 Yuki Kimoto
MIT License