Net::Mosso::CloudFiles::Object - Represent a Cloud Files object
# To create a new object my $xxx = $container->object( name => 'XXX' ); $xxx->put('this is the value'); # To create a new object with the contents of a local file my $yyy = $container->object( name => 'YYY', content_type => 'text/plain' ); $yyy->put_filename('README'); # To fetch an object: my $xxx2 = $container->object( name => 'XXX' ); my $value = $xxx2->get; say 'has name ' . $xxx2->name; say 'has md5 ' . $xxx2->etag; say 'has size ' . $xxx2->size; say 'has content type ' . $xxx2->content_type; say 'has last_modified ' . $xxx2->last_modified; # To download an object to a local file $yyy->get_filename('README.downloaded');
This class represents an object in Cloud Files. It is created by calling object or objects on a Net::Mosso::CloudFiles::Container object.
Returns the name of the object.
say 'has name ' . $object->name;
Fetches the metadata of the object:
$object->head;
Fetches the metadata and content of an object:
my $value = $object->get;
Downloads the content of an object to a local file, checks the integrity of the file, sets metadata in the object and sets the last modified time of the file to the same as the object.
$object->get_filename('README.downloaded');
Deletes an object:
$object->delete;
Creates a new object:
my $xxx = $container->object( name => 'XXX' ); $xxx->put('this is the value');
Creates a new object with the contents of a local file:
my $yyy = $container->object( name => 'YYY', content_type => 'text/plain' ); $yyy->put_filename('README');
Returns the entity tag of the object, which is its MD5:
say 'has md5 ' . $object->etag;
Return the size of an object in bytes:
say 'has size ' . $object->size;
Return the content type of an object:
say 'has content type ' . $object->content_type;
Return the last modified time of an object as a DateTime object:
say 'has last_modified ' . $object->last_modified;
Net::Mosso::CloudFiles, Net::Mosso::CloudFiles::Container.
Leon Brocard <acme@astray.com>.
Copyright (C) 2008-9, Leon Brocard
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
To install Net::Mosso::CloudFiles, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Mosso::CloudFiles
CPAN shell
perl -MCPAN -e shell install Net::Mosso::CloudFiles
For more information on module installation, please visit the detailed CPAN module installation guide.