AWS::S3::File - A single file in Amazon S3
my $file = $bucket->file('foo/bar.txt'); # contents is a scalarref: print @{ $file->contents }; print $file->size; print $file->key; print $file->etag; print $file->lastmodified; print $file->owner->display_name; print $file->bucket->name; # Set the contents with a scalarref: my $new_contents = "This is the new contents of the file."; $file->contents( \$new_contents ); # Set the contents with a coderef: $file->contents( sub { return \$new_contents; }); # Alternative update $file->update( contents => \'New contents', # optional contenttype => 'text/plain' # optional ); # Delete the file: $file->delete();
AWS::S3::File provides a convenience wrapper for dealing with files stored in S3.
AWS::S3::Bucket - read-only.
The AWS::S3::Bucket that contains the file.
String - read-only.
The 'filename' (for all intents and purposes) of the file.
Integer - read-only.
The size in bytes of the file.
The Amazon S3 'ETag' header for the file.
ASW::S3::Owner - read-only.
The ASW::S3::Owner that the file belongs to.
The type of storage used by the file.
A date in this format:
2009-10-28T22:32:00
ScalarRef|CodeRef - read-write.
Returns a scalar-reference of the file's contents.
Accepts either a scalar-ref or a code-ref (which would return a scalar-ref).
Once given a new value, the file is instantly updated on Amazon S3.
# GOOD: (uses scalarrefs) my $value = "A string"; $file->contents( \$value ); $file->contents( sub { return \$value } ); # BAD: (not scalarrefs) $file->contents( $value ); $file->contents( sub { return $value } );
Deletes the file from Amazon S3.
Update contents and/or contenttype of the file.
The Amazon S3 API Documentation
AWS::S3
AWS::S3::Bucket
AWS::S3::FileIterator
AWS::S3::Owner
John Drago <jdrago_999@yahoo.com>
This software is Free software and may be used and redistributed under the same terms as any version of perl itself.
Copyright John Drago 2011 all rights reserved.
To install AWS::S3, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AWS::S3
CPAN shell
perl -MCPAN -e shell install AWS::S3
For more information on module installation, please visit the detailed CPAN module installation guide.