NAME
Nuvol::Item - Item in a drive
SYNOPSIS
use Nuvol;
my $drive = Nuvol::connect($configfile)->drive($drive_path);
my $item = $drive->item($path);
$item->drive;
$item->exists;
$item->file;
$item->folder;
$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;
DESCRIPTION
Nuvol::Item is an item in a drive. It can be either a file or a folder.
CONSTRUCTOR
via Nuvol::Drive
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 with trailing slash are interpreted as folders, without slash as files.
new
$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.
METHODS
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
$drive = $item->drive;
Getter for the drive. Returns a Nuvol::Drive.
exists
$bool = $item->exists;
Checks if the item exists.
file
$bool = $item->file;
Returns a true value if the "type" of the item is File
.
folder
$bool = $item->folder;
Returns a true value if the "type" of the item is Folder
.
type
$type = $item->type;
Getter for the type, can be File
or Folder
.