NAME
Parrot::IO::Path - Path
DESCRIPTION
Parrot::IO::Path
is an abstract superclass providing common path logic for Parrot::IO::File
and Parrot::IO::Directory
.
Instances created with new()
are cached so that there is only one unique instance for each path.
Class Methods
new($path)
-
Returns the instance for
$path
if it already exists, otherwise it is created and cached. A relative path is made absolute.
Instance Methods
create_path()
-
This is called from
new()
to create the parent path if necessary. Subclasses should reimplement this method to complete the task. path()
-
Returns the actual path.
name()
-
Returns the name part of the path.
name_without_suffix()
-
This will give you the name minus any .xyz suffix.
suffix()
-
Use this to get the name's .xyz suffix or extension. If there is no suffix then the empty string is returned.
has_suffix()
-
Finds out whether the name has a .xyz suffix.
has_suffix($suffix)
-
Finds out whether the name suffix is
$suffix
.Note that if a name has no suffix and if
$suffix
is the empty string then this method will return true. parent_path()
-
Returns the path of the containing directory.
stat()
-
Returns the
File::stat
object. Used by subclasses to get information about the path. delete()
-
Removes the instance from the cache, and undefines it.