AWS-S3
view release on metacpan or search on metacpan
0.020 2011-12-21
- Updated to be compatible with VSO 0.21
0.019 2011-12-14
- Bucket's S3 was a weak ref, which caused problems sometimes. Not anymore...
we'll see if that fixes it.
0.018 2011-12-13
- Thanks to ukautz++ (Ulrich Kautz) for adding the ability to set the content-type
of files stored in S3.
- He even updated the POD to show how to set the content-type (via 'contenttype').
0.017 2011-12-11
- Fixed broken META.yml (again)
0.016 2011-12-10
- Fixed broken META.yml
0.015 2011-12-10
- Migrated to github.
- Added repository url to meta.
lib/AWS/S3/File.pm view on Meta::CPAN
2009-10-28T22:32:00
=head2 contents
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 } );
t/010_basic.t view on Meta::CPAN
ok my $file = $bucket->file('code/test.txt'), "got file back from bucket";
is ${$file->contents}, $text, "file.contents on code is correct";
$file->contents( sub { return \uc($text) } );
is ${$file->contents}, uc($text), "file.contents on code is correct after update";
$file->delete;
};
# Set contents:
SET_CONTENTS: {
my $new_contents = "This is the updated value"x10;
ok my $file = $bucket->file($filename), 'bucket.file(filename) works';
$file->contents( \$new_contents );
# Now check it:
is ${$bucket->file($filename)->contents}, $new_contents, "set file.contents works";
# use alternative update method
$new_contents = 'More new content';
$file->update( contents => \$new_contents );
is ${$bucket->file($filename)->contents}, $new_contents, "set file.update works";
( run in 0.341 second using v1.01-cache-2.11-cpan-05444aca049 )