Nuvol::Item - Item in a drive
use Nuvol; my $drive = Nuvol::connect($configfile)->drive($drive_path); my $item = $drive->item($path); $item->drive; $item->exists; $item->is_file; $item->is_folder; $item->realpath; $item->type; # files $item->copy_from; $item->copy_to; $item->spurt; $item->slurp; $item->download_url; $item->remove; # folders $item->make_path; $item->remove_tree; # metadata $item->description; $item->id; $item->metadata; $item->name;
Nuvol::Item is an item in a drive. It can be either a file or a folder.
The syntax for drive items is oriented at Mojo::File, so anyone familiar with this module will recognize most of the methods.
use Nuvol; $drive = Nuvol::Connector->new($configfile)->drive(%drive_path); $file = $connector->item('/path/to/file'); $folder = $connector->item('/path/to/folder/');
In daily use a Nuvol::Item is created with "item" in Nuvol::Drive. Paths must be absolute (starting with a slash). Paths with trailing slash are interpreted as folders, without slash as files.
$item = Nuvol::Item->new($drive, {id => $id}); $item = Nuvol::Item->new($drive, {metadata => $metadata}); $item = Nuvol::Item->new($drive, {path => $path});
The internal constructor can be used if the id or metadata of the item are known.
id
metadata
If a Nuvol::Item is a file it inherits the following methods from Nuvol::Role::File:
A folder inherits the following methods from Nuvol::Role::Folder:
All item types inherit the following methods from Nuvol::Role::Metadata:
$drive = $item->drive;
Getter for the drive. Returns a Nuvol::Drive.
$bool = $item->exists;
Checks if the item exists.
$bool = $item->is_file;
Returns a true value if the "type" of the item is File.
File
$bool = $item->is_folder;
Returns a true value if the "type" of the item is Folder.
Folder
$realpath = $item->realpath;
Getter for the full path of the item relative to its drive. Returns a Mojo::Path.
# '/path%20to/item' say $item->realpath; # '/path to/item' say $item->realpath->to_route;
Real paths are URL escaped. "to_route" in Mojo::Path returns the unescaped string.
$type = $item->type;
Getter for the type, can be File or Folder.
Mojo::File, Nuvol::Drive, Nuvol::Role::File, Nuvol::Role::Folder.
To install Nuvol, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nuvol
CPAN shell
perl -MCPAN -e shell install Nuvol
For more information on module installation, please visit the detailed CPAN module installation guide.