NAME
Parrot::IO::Directory - Directory in the Parrot distribution.
SYNOPSIS
use Parrot::IO::Directory;
my $dir = Parrot::IO::Directory->new('parrot');
DESCRIPTION
Methods
file_class()
-
Returns the class used in the various file creation methods. This default implementation returns
Parrot::IO::File
. tmp_directory($path)
-
Returns the directory for
$path
relative to the default temporary directory. new($path)
-
Returns the instance for
$path
. create_path()
-
This is called from
new()
to create the path if necessary. relative_path($path)
-
Returns
$path
relative to the directory. parent($path)
-
Returns the directory's parent directory.
file_and_directory_names()
-
These are the names of all the files and subdirectories in the directory.
file_and_directory_paths()
-
These are the full paths of all the files and subdirectories in the directory.
file_paths()
-
These are the full paths of all the files in the directory.
directory_paths()
-
These are the full paths of all the subdirectories in the directory.
files($recursive, $ignore)
-
This gives you an array of
Parrot::IO::File
instances.Set
$recursive
to true if you want all files in subdirectories to be included. To ignore everything below particular directories use a regex in$ignore
. directories()
-
This gives you an array of instances of the same class as the directory itself.
file_suffixes($recursive, $ignore)
-
Use this to get an array of the file type suffixes used for files in the directory.
$recursive
and$ignore
function as specified above forfiles()
.For example:
$parrot->file_suffixes(1, '^(CVS|icu)$');
will give you all the suffixes used in Parrot ignoring all CVS and ICU files.
Note that if there are files with no suffix then the empty string will be included in this list.
files_with_suffix($suffix, $recursive, $ignore)
-
Use this to get a list of the files with a particular suffix.
$recursive
and$ignore
function as specified above forfiles()
.Note that if
$suffix
is the empty string then this will return all the files with no suffix. directory_with_name($name)
-
Returns a directory with the specified name in the directory.
file_with_name($name)
-
Returns a file with the specified name in the directory.
relative_path_is_directory($path)
-
Returns whether the specified relative path is a directory.
relative_path_is_file($path)
-
Returns whether the specified relative path is a file.
directory_with_relative_path($path)
-
Returns a directory with the specified relative path below the directory.
file_with_relative_path($path)
-
Returns a file with the specified relative path below the directory.
delete()
-
Deletes the directory and all its contents, removes the instance from the cache, and undefines it.
Raises an exception if the delete fails.
delete_contents()
-
Deletes the contents of the directory.
Raises an exception if the delete fails.
SEE ALSO
Parrot::IO::File
, Parrot::IO::Path
.