Nuvol - A cloud toolkit
use Nuvol; # connect to a service my $configfile = '/path/to/configfile'; my $service = '...'; # one of Dropbox, Office365 my $connector = Nuvol::autoconnect($configfile, $service); # get main drive my $drive = $connector->drive('~'); # upload a file use Mojo::File 'path'; my $file = $drive->item('/My Text.txt')->copy_from(path 'Text on my PC.txt'); # copy to another file my $file_2 = $file->copy_to('/path/to/Text Copy.txt'); # download my $downloaded = $file_2->copy_to(path 'Downloaded Text.txt'); # change the text $file_2->spurt('This text was changed.'); # read it my $content = $file_2->slurp; # and delete the file $file_2->remove;
Nuvol └── Connector ├── Config │ └── config file └── Drive └── Item ├── File └── Folder
The services are organized in connectors, drives, items, files, and folders. The data needed to access a service is stored in a config file.
The Connector is responsible for authentication and for the connection to the cloud service.
- Config and config file
The config file stores the tokens and other parameters used to establish a connection. Internally is is represented by a Config object.
Warning: The information in the config file allows full access to your cloud data for anyone who can read it. It should be stored at a secure place. Services that are no longer used should be disabled with "disconnect" in Nuvol::Connector.
A Drive is an isolated area where your data is stored. You may have a drive for your personal and another for your business data. Not all cloud providers support different drives.
The syntax for drive items is oriented at Mojo::File, so anyone familiar with this module will recognize most of the methods.
None of the functions is exported.
use Nuvol; $connector = Nuvol::autoconnect($configfile, $service);
Opens a connection using an existing config file, or starts an interactive authentication process if the file doesn't exist. Returns a Nuvol::Connector.
use Nuvol; $connector = Nuvol::connect($configfile);
Opens a connection using an existing config file. Returns a Nuvol::Connector.
© 2013–2020 by Tekki (Rolf Stöckli).
This program is free software, you can redistribute it and/or modify it under the terms of the Artistic License version 2.0.